|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm trying to populate a textbox (permissID) from my Access Database table (userID). I get no error message, but no text populates the textbox after I click the button that calls this function. What am I missing?
Function GetUser(ByVal userName AS String, ByVal Password As String) As System.Data.DataSet Dim dbConn As System.Data.IDbConnection= _ New System.Data.OleDb.OleDbConnection(ConfigurationSettings.AppSettings("strConn")) Dim strSQl As String= "Select userName, permissID FROM tblUsers"& _ " WHERE userName= @userName AND password= @Password" Dim dbComm As System.Data.IDbCommand= New System.Data.OleDb.OleDbCommand dbComm.CommandText= strSQl dbComm.Connection= dbConn Dim dbParam_userName As System.Data.IDataParameter= New System.Data.OleDb.OleDbParameter dbParam_userName.ParameterName= "@userName" dbParam_userName.Value = userName dbParam_userName.DbType = System.Data.DbType.String dbComm.Parameters.Add(dbParam_userName) Dim dbParam_password As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter dbParam_password.ParameterName= "@password" dbParam_password.Value= password dbParam_password.DbType= System.Data.DbType.String dbComm.Parameters.Add(dbParam_password) Dim DA As System.Data.IDbDataAdapter= New System.Data.OleDb.OleDbDataAdapter DA.SelectCommand= dbComm Dim DS As DataSet= New DataSet DA.Fill(DS) Return DS Dim i As Integer i=i+1 permissID.Text= (DS.Tables(0).Rows(i).Item("permissID")) End Function |
|
#2
|
|||
|
|||
|
You're returning the DataSet object before anything is assigned to the textbox. By doing this, you're telling the compiler to ignore anything that happens after a reference to the DataSet object has been returned to the caller.
Code:
DA.Fill(DS)
Return DS
Dim i As Integer
i=i+1
permissID.Text= (DS.Tables(0).Rows(i).Item("permissID"))
|
|
#3
|
|||
|
|||
|
Hello
How d'u make a combobox autocomplete in c#?? ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > .Net Development > Populate textbox |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|