.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 11th, 2004, 09:21 AM
edp1959 edp1959 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 7 edp1959 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 7 sec
Reputation Power: 0
Arrow Populate textbox

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

Reply With Quote
  #2  
Old March 11th, 2004, 01:27 PM
sano sano is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Location: Redmond, WA
Posts: 218 sano User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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"))

Reply With Quote
  #3  
Old March 17th, 2004, 11:54 AM
aartz aartz is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 22 aartz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hello
How d'u make a combobox autocomplete in c#??

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Populate textbox


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT