while without wend error
visual basic
Collapse
X
-
Originally posted by chanswhile without wend errorComment
-
I am a beginner for VB. i am writing a code which has to display details of employee from database. hav a look at my code...
Private Sub Combo1_click()
Combo1.AddItem ("1233")
Combo1.AddItem ("1234")
Combo1.AddItem ("3343")
End Sub
Private Sub Form_Load()
Dim adoRecordset As ADODB.Recordset
Dim db As New ADODB.Connectio n
Dim mDatabaseName As String
Dim mDBserverName As String
mDatabaseName = "chandru"
mDBserverName = "(local)"
db.Connectionst ring = "Driver={SQ L Server};Provide r=MSDASQL.1;DAT ABASE=" & mDatabaseName & ";uid=sa;pwd=vm s;Server=" & mDBserverName & ";"
Set adoRecordset = New ADODB.Recordset
adoRecordset.Op en "select name from employee", db.Connectionst ring
If (Combo1 = "ssn") Then
Set Text1.DataSourc e = adoRecordset
Text1.DataField = "name"
Set Text2.DataSourc e = adoRecordset
Text2.DataField = "age"
Set Text3.DataSourc e = adoRecordset
Text3.DataField = "dept"
End If
End Sub
if i use form load for combo box it gives ambigous error....i want to add command button also plz giv ur suggestion plzComment
-
Originally posted by chansadoRecordset.Op en "select name from employee", db.Connectionst ring
If (Combo1 = "ssn") Then
Set Text1.DataSourc e = adoRecordset
Text1.DataField = "name"
Set Text2.DataSourc e = adoRecordset
Text2.DataField = "age"
Set Text3.DataSourc e = adoRecordset
Text3.DataField = "dept"
End If
End Sub
then how your DataField is age and dept for text2 and text3 respectively.Comment
-
Originally posted by chanswhen i click on command button on giving ssn it has to retrive all info from employee table
adoRecordset.Op en "select age from employee", db.Connectionst ring
adoRecordset.Op en "select dept from employee", db.Connectionst ring
If (Combo1 = "ssn") Then
Set Text1.DataSourc e = adoRecordset
Text1.DataField = "name"
Set Text2.DataSourc e = adoRecordset
Text2.DataField = "age"
Set Text3.DataSourc e = adoRecordset
Text3.DataField = "dept"
End If
is this ok now sirComment
-
Originally posted by chanswhen i click on command button on giving ssn it has to retrive all info from employee table
Hello,
http://www.thescripts. com/forum/thread718154.ht ml
go to this and download my attachment, maybe it could help for your lesson.
Study the program.
its simple.
Regards
Phils ErvinComment
Comment