| | |
Searching multiple MS SQL Tables
Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
hi,
In Total how many tables do u need to do search operation..?
If Many Tables, and many recs in each table, then this will be a huge Overhead on the database.
But if u need to do it compulsorily, Write a Stroredprocedure which accepts Search String. And Checks each table and returns Table Name/id/fieldname if found..
Regards
Veena
In Total how many tables do u need to do search operation..?
If Many Tables, and many recs in each table, then this will be a huge Overhead on the database.
But if u need to do it compulsorily, Write a Stroredprocedure which accepts Search String. And Checks each table and returns Table Name/id/fieldname if found..
Regards
Veena
Hi,
u can check the Storedprocedure here
It Checks and Replaces, u can modify it to Check and Return back...
Regards
Veena
u can check the Storedprocedure here
It Checks and Replaces, u can modify it to Check and Return back...
Regards
Veena
•
•
Join Date: Aug 2007
Posts: 44
Reputation:
Solved Threads: 0
I have been working on this for a while.
Using the stored Procedure from the link QVeen72 provided I have been able to get the search results I want with in SQL.
My problem is getting this to display in vb.net in a data grid.
Can anyone offer some help as to where to look for a solution.
The code I am using at the moment is:
Dim cs As String = "Data Source=.\SQLEXPRESS;Initial Catalog=Database;Integrated Security=True"
Using con As New System.Data.SqlClient.SqlConnection(cs)
con.Open()
Dim cmd As New System.Data.SqlClient.SqlCommand()
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "SearchAllTables"
cmd.Parameters.Add("@SearchStr", SqlDbType.NVarChar, 12)
cmd.Parameters("@SearchStr").Value = TextBox1.Text
Using reader As System.Data.SqlClient.SqlDataReader = cmd.ExecuteReader()
DataGridView1.DataSource = reader
End Using
The information I have see says that the last line should add: DataGridView1.DataBind, but I do no seem to have this as an option and it does not work if there is.
Using the stored Procedure from the link QVeen72 provided I have been able to get the search results I want with in SQL.
My problem is getting this to display in vb.net in a data grid.
Can anyone offer some help as to where to look for a solution.
The code I am using at the moment is:
Dim cs As String = "Data Source=.\SQLEXPRESS;Initial Catalog=Database;Integrated Security=True"
Using con As New System.Data.SqlClient.SqlConnection(cs)
con.Open()
Dim cmd As New System.Data.SqlClient.SqlCommand()
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "SearchAllTables"
cmd.Parameters.Add("@SearchStr", SqlDbType.NVarChar, 12)
cmd.Parameters("@SearchStr").Value = TextBox1.Text
Using reader As System.Data.SqlClient.SqlDataReader = cmd.ExecuteReader()
DataGridView1.DataSource = reader
End Using
The information I have see says that the last line should add: DataGridView1.DataBind, but I do no seem to have this as an option and it does not work if there is.
One thing I have learnt is it is not what you know, but knowing what you don't that makes the difference.
![]() |
Similar Threads
- php drop down menu to search multiple sql tables (PHP)
- Problem searching multiple sheets in excel (Visual Basic 4 / 5 / 6)
- SQL Tables export (VB.NET)
Other Threads in the VB.NET Forum
- Previous Thread: simple paint similar to MS Paint.. I have qustions!
- Next Thread: Drill Down
Views: 3807 | Replies: 18
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
"crystal .net .net2005 30minutes 2008 access application arithmetic array assignment basic binary box button buttons center code combobox component connectionstring convert cpu data database databasesearch datagrid datagridview design designer dissertation dissertations dissertationthesis dll dosconsolevb.net editvb.net error excel firewall folder highlighting image images isnumericfuntioncall listview login math memory mobile ms mssqlbackend mysql navigate net opacity pan peertopeervideostreaming picturebox picturebox1 plugin port print printing printpreview problem problemwithinstallation project record reports" reuse save savedialog serial server sorting sql storedprocedure string structures studio temp textbox timer updown upload useraccounts usercontrol vb vb.net vb.netcode vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web wpf





