Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

At the moment I am using the following code to populate a datatable using a stroed procedure, which return a large amount of information from my MS SQL table. What I would like to do is then apply an SQL select statement to the datatable so that I can filter down the data in the datatable further. The reason why I want to do this is instead of having a large number of stored procedures for each senario, is this possible

 

Dim myDA As New OleDb.OleDbDataAdapter("spQryParentComments", myDB.myConn)
           myDA.SelectCommand.CommandType = CommandType.StoredProcedure
           myDA.SelectCommand.Parameters.Add(New OleDb.OleDbParameter("@projName", OleDb.OleDbType.VarChar)).Value = RISData.Instance.ProjectName
           myDA.SelectCommand.Parameters.Add(New OleDb.OleDbParameter("@userID", OleDb.OleDbType.VarChar)).Value = RISData.Instance.UserID

           Dim dataParentTable As DataTable = New DataTable("Parent")

' e.g.
dataParentTable.selectcommand("SELECT * WHERE [column] = [XYZ]")

           myDA.Fill(dataParentTable)

 

Thanks in advance

 

Simon

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...