OLE DB and ASP.Net

burakv

New Member
Hello,<BR><BR>I am using asp.net for a couple of days and I'd like to use OLE-DB connection (I proceed like that on asp).<BR><BR>Here is the lines I use to open the connection<BR><BR>public void Page_Load() <BR><BR>{<BR>DataSet ds = new DataSet();<BR>OleDbConnection myConnection = new OleDbConnection("server=NETFORCE;uid=sa;pwd=;database=northwind;pro vider=sqloledb");<BR>OleDbCommand myCommand = new OleDbCommand("SELECT * FROM Employees", myConnection);<BR>myConnection.Open();<BR>.......<BR>.......<BR>myConnection.Close();<BR>}<BR><BR>The problem : <BR>The connection opens correctly (no error messages) but I didn't find a way to fill a dataset. <BR><BR>But I can fill one if I proceed like this :<BR><BR> public void BindGrid(String Sortfield) <BR> {<BR> SqlConnection myConnection = new SqlConnection("server=NETFORCE;uid=sa;pwd=;database=northwind");<BR> /*OleDbConnection myConnection = new OleDbConnection<BR><BR><BR> String StrSQL = "select Top 60 * from Products ";<BR><BR> SqlDataAdapter myCommand = new SqlDataAdapter(StrSQL, myConnection);<BR><BR> DataSet ds = new DataSet();<BR> myCommand.Fill(ds, "Products");<BR><BR> DataView Source = ds.Tables["Products"].DefaultView;<BR> Source.Sort=Sortfield;<BR><BR> MyDataGrid.DataSource = Source;<BR> MyDataGrid.DataBind();<BR> myConnection.Close();<BR> <BR> }<BR><BR>Can someone help me ?<BR><BR>Thanks
 
Back
Top