Trying to learn some ASP.NET

Results 1 to 2 of 2

Thread: Trying to learn some ASP.NET

  1. #1
    Join Date
    Dec 1969

    Default Trying to learn some ASP.NET

    But I can&#039;t even get data in a drop down list. Anyone see why it isn&#039;t working?<BR> <BR> Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)<BR> Dim connString As String<BR> connString = "MyString"<BR><BR> &#039;Open a connection<BR> Dim objConnection As SqlConnection<BR> objConnection = New SqlConnection(connString)<BR><BR> objConnection.Open()<BR> &#039;Specify the SQL string<BR> Dim strSQL As String = "SELECT * FROM Customers"<BR><BR> &#039;Create a command object<BR> Dim objCommand As SqlCommand<BR> objCommand = New SqlCommand(strSQL, objConnection)<BR><BR> &#039;Get a datareader<BR> Dim objDataReader As SqlDataReader<BR> objDataReader = objCommand.ExecuteReader(CommandBehavior.CloseConn ection)<BR><BR> &#039;Do the DataBinding<BR> OfficeList.DataSource = objDataReader<BR> OfficeList.DataTextField = "Office"<BR> OfficeList.DataValueField = "Office_Type"<BR> OfficeList.DataBind()<BR><BR> &#039;Close the datareader/db connection<BR> objDataReader.Close()

  2. #2
    Join Date
    Dec 1969

    Default RE: Trying to learn some ASP.NET

    Looks ok to me. Can you step through it and see what is happening? You need to debug. Is this code scripting or code-behind?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts