Searching multiple MS SQL Tables

Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Aug 2007
Posts: 44
Reputation: TaoistTotty is an unknown quantity at this point 
Solved Threads: 0
TaoistTotty TaoistTotty is offline Offline
Light Poster

Re: Searching multiple MS SQL Tables

 
0
  #11
Aug 7th, 2007
QVeen72, I am using SQL Server Express edition at the moment, but do have full standard version available if needed.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Searching multiple MS SQL Tables

 
0
  #12
Aug 7th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Searching multiple MS SQL Tables

 
0
  #13
Aug 7th, 2007
Hi,

u can check the Storedprocedure here
It Checks and Replaces, u can modify it to Check and Return back...

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 44
Reputation: TaoistTotty is an unknown quantity at this point 
Solved Threads: 0
TaoistTotty TaoistTotty is offline Offline
Light Poster

Re: Searching multiple MS SQL Tables

 
0
  #14
Aug 7th, 2007
There are five tables, and I imaging in total about 5,000 records (once completed).

Thank you for the link, that looks great.
Last edited by TaoistTotty; Aug 7th, 2007 at 4:05 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 44
Reputation: TaoistTotty is an unknown quantity at this point 
Solved Threads: 0
TaoistTotty TaoistTotty is offline Offline
Light Poster

Re: Searching multiple MS SQL Tables

 
0
  #15
Aug 9th, 2007
I have had a chance to test the code and it works well, not all I have to do is to work out how to get the result into a format that will be useful to me.

Time to try and put my thinking cap on.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Searching multiple MS SQL Tables

 
0
  #16
Aug 10th, 2007
Hi,

Just Get the Stored procedure to output these parameters, If the Search is Matched..:

TableName, FieldName, FieldValue, ID of the Matched record.

If user selects some thing from the List, the Next drill down would be easy since u know Table name, field name and ID of the Table...

REgards
Veena
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 44
Reputation: TaoistTotty is an unknown quantity at this point 
Solved Threads: 0
TaoistTotty TaoistTotty is offline Offline
Light Poster

Re: Searching multiple MS SQL Tables

 
0
  #17
Aug 10th, 2007
Thanks Veena.

This will enable everything to work.

Thanks once again.

Michael
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 44
Reputation: TaoistTotty is an unknown quantity at this point 
Solved Threads: 0
TaoistTotty TaoistTotty is offline Offline
Light Poster

Re: Searching multiple MS SQL Tables

 
0
  #18
Sep 3rd, 2007
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.
One thing I have learnt is it is not what you know, but knowing what you don't that makes the difference.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 44
Reputation: TaoistTotty is an unknown quantity at this point 
Solved Threads: 0
TaoistTotty TaoistTotty is offline Offline
Light Poster

Re: Searching multiple MS SQL Tables

 
0
  #19
Sep 7th, 2007
I have managed to get everything solved.

Thank you for your help.
Last edited by TaoistTotty; Sep 7th, 2007 at 10:51 am.
One thing I have learnt is it is not what you know, but knowing what you don't that makes the difference.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum


Views: 3807 | Replies: 18
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC