Results 1 to 6 of 6

Thread: RESOLVED!! Assigning dataset values to a text box

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381

    Question RESOLVED!! Assigning dataset values to a text box

    The script below gives me back a record (i.e. FNAME, LNAME, STUDENTID) that I will bind to a datagrid. After binding, I get value of each cell in the webform datagrid and place it on a webform textbox. Is there a better way to do this so that I skip the datagrid binding and assign the values to a text box directly? Do I have other option other than using a dataReader just like a recordset in VB6?

    Thanks

    Code:
                Dim connectionString As String = "server='SQLSERVER1'; user id='RAUser1'; password='letmein'; database='RA'"
                Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)
    
                Dim queryString As String = "SELECT [RAUser].* FROM [RAUser] WHERE (([RAUser].[LoginName] = @LoginName) AND ([" & _
        "RAUser].[LoginPass] = @LoginPass))"
                Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
                dbCommand.CommandText = queryString
                dbCommand.Connection = dbConnection
    
                Dim dbParam_loginName As System.Data.IDataParameter = New System.Data.SqlClient.SqlParameter
                dbParam_loginName.ParameterName = "@LoginName"
                dbParam_loginName.Value = loginName
                dbParam_loginName.DbType = System.Data.DbType.String
                dbCommand.Parameters.Add(dbParam_loginName)
                Dim dbParam_loginPass As System.Data.IDataParameter = New System.Data.SqlClient.SqlParameter
                dbParam_loginPass.ParameterName = "@LoginPass"
                dbParam_loginPass.Value = loginPass
                dbParam_loginPass.DbType = System.Data.DbType.String
                dbCommand.Parameters.Add(dbParam_loginPass)
    
                dbConnection.Open()
                Dim dataReader As System.Data.IDataReader = dbCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
    	    Return dataReader
    Last edited by ARPRINCE; Feb 16th, 2004 at 12:31 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width