Last post Sep 15, 2009 12:18 PM by Prati_tr
Apr 26, 2007 01:55 AM|bank5|LINK
It's a pretty basic question but I haven't been able to find any examples out there. I dimmed a dataadapter and would like to reuse later in my code (line 3 in the code below). What is the correct syntax to do this?
Dim da As New SqlDataAdapter("SELECT * FROM myTable", conn)
da.______ ("SELECT * FROM myTable2", conn)
Apr 30, 2007 05:52 AM|Nai-Dong Jin - MSFT|LINK
You need to use the "new" keyword to create an object instance for another sql statement.
Sep 15, 2009 12:18 PM|Prati_tr|LINK
You can reuse the SQL Data adapter in the following way..
string SQL1 = "SELECT * FROM Invoice";
string SQL2 = "SELECT * FROM InvoiceDetail";
string SQL3 = "SELECT * FROM TallyExportProperties";
DataSet dsExport = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(SQL1,cnn);
da.SelectCommand.CommandText = SQL2;
da.SelectCommand.CommandText = SQL3;