lidds Posted September 19, 2008 Posted September 19, 2008 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 Quote
Administrators PlausiblyDamp Posted September 20, 2008 Administrators Posted September 20, 2008 Have you tried using a DataView? These allow you to filter or sort a datatable without having to requery the database. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.