data adpter
-
i m creating a data adapter but is not working..is it the correct way?? OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn); da.Fill(ds, "table name");
$h@ma!|@
yes it should be right. what's the error?
-
yes it should be right. what's the error?
-
Error 1 The best overloaded method match for 'System.Data.OleDb.OleDbDataAdapter.OleDbDataAdapter(string, string)' has some invalid arguments Error 2 Argument '2': cannot convert from 'System.Data.SqlClient.SqlConnection' to 'string'
$h@ma!|@
if u provide ur data binding function.it wil be easy to rectify it.
-
if u provide ur data binding function.it wil be easy to rectify it.
-
yes it should be right. what's the error?
u shd decleare the namespace System.Data.OleDb.OleDbConnection
-
OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn); conn.Close(); DataSet ds = new DataSet(); da.Fill(ds, "table name"); searchgrid.DataSource = ds.DefaultViewManager;
$h@ma!|@
try this one OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn); conn.Close(); DataSet ds = new DataSet(); da.Fill(ds, "table name"); searchgrid.DataSource = ds; searchgrid.databind();
-
i m creating a data adapter but is not working..is it the correct way?? OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn); da.Fill(ds, "table name");
$h@ma!|@
$h@ma!|@ wrote:
OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn);
What is the type of conn ? OledbDataAdapter is having 4 overloaded methods. 1. public OleDbDataAdapter ( System.String selectCommandText , System.Data.OleDb.OleDbConnection selectConnection ) In this you need to pass the select query and OledbConnection object as parameters 2. public OleDbDataAdapter ( System.String selectCommandText , System.String selectConnectionString ) In this pass Query and connection string 3. public OleDbDataAdapter ( System.Data.OleDb.OleDbCommand selectCommand ) This accepts OledbCommand object and last one is with no parameters. Check your call matches with these methods ?
-
try this one OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn); conn.Close(); DataSet ds = new DataSet(); da.Fill(ds, "table name"); searchgrid.DataSource = ds; searchgrid.databind();
Sonia Gupta wrote:
conn.Close(); DataSet ds = new DataSet(); da.Fill(ds, "table name");
Is it possible to fill DS when connection is closed ?
-
$h@ma!|@ wrote:
OleDbDataAdapter da = new OleDbDataAdapter(strQuery, conn);
What is the type of conn ? OledbDataAdapter is having 4 overloaded methods. 1. public OleDbDataAdapter ( System.String selectCommandText , System.Data.OleDb.OleDbConnection selectConnection ) In this you need to pass the select query and OledbConnection object as parameters 2. public OleDbDataAdapter ( System.String selectCommandText , System.String selectConnectionString ) In this pass Query and connection string 3. public OleDbDataAdapter ( System.Data.OleDb.OleDbCommand selectCommand ) This accepts OledbCommand object and last one is with no parameters. Check your call matches with these methods ?