
May 8th, 2002, 07:25 AM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,575
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
ODBC-connection and dataset problem
<i><b>Originally posted by : Andy (move_mania@yahoo.com)</b></i><br />Hi !<br /><br />I've just started learning ASP.NET - I've been dealing with "good ol' ASP" over a year but this dot-net causes troubles. I've made an ODBC connection to database and I've managed to bind the data into datagrie. But I need a dataset, or at least I think it's the way to go. I cannot get it work in any way since those command-objects are a bit too tricky for me. So, I want to put querydata to a dataset and then bind it to a listbox. <br /><br />Thanks for your help, here is my code:<br /><br />Dim _ODBCConnection As New Microsoft.Data.Odbc.OdbcConnection()<br />Dim _Command As New Microsoft.Data.Odbc.OdbcCommand()<br /> _ODBCConnection.ConnectionString = "DSN=mydsn;"<br /> _Command.CommandText = "SELECT pkey, surveyid FROM data"<br />_Command.Connection = _ODBCConnection<br />_ODBCConnection.Open()<br />_Command.Connection.Close()<br /><br />This doesnt work:<br />st.DataSource = _Command.ExecuteReader()<br />st.DataBind()<br /><br /><ASP:listbox id="st" runat="server"/>
|