Hi all,
I,m new to vb.6.0 and i don,t know how to connect to sql server through v.b 6.0 with the help of adodc control, and anyone plz tell me how connect and insert ,update,delete and other functions, coz i tried in m.s access not in sqlserver,
This is the coding which i used in ms.access
[code=vb]
'for insert
rs.Fields(0) = Text1.Text
rs.Fields(1) = Text2.Text
rs.AddNew
rs.Update
for update
rs.Fields(0) = Text1.Text
rs.Fields(1) = Text2.Text
rs.Update
MsgBox "You suceesfully inserted the value"
adodc1.Refresh
Grid1.Refresh
for select
Dim con As ADODB.Connectio n
Dim rs As ADODB.Recordset
Dim strconnect As String
Set con = New ADODB.Connectio n
Set rs = New ADODB.Recordset
strconnect = "Driver={SQ L Server};Server= FOCUSSERVER;Dat abase=Northwind ;Uid=sa;"
con.Open strconnect
rs.Open "select * from Sales", con, adOpenDynamic, adLockOptimisti c
MsgBox "Connected Suceesfully"
'for delete
rs.Delete
MsgBox "You suceesfully deleted the record"
rs.MoveFirst
Adodc1.Refresh
[/code]
can anyone plz tell me what changes should i do in above codings or send me some sample coding plz urgent
I,m new to vb.6.0 and i don,t know how to connect to sql server through v.b 6.0 with the help of adodc control, and anyone plz tell me how connect and insert ,update,delete and other functions, coz i tried in m.s access not in sqlserver,
This is the coding which i used in ms.access
[code=vb]
'for insert
rs.Fields(0) = Text1.Text
rs.Fields(1) = Text2.Text
rs.AddNew
rs.Update
for update
rs.Fields(0) = Text1.Text
rs.Fields(1) = Text2.Text
rs.Update
MsgBox "You suceesfully inserted the value"
adodc1.Refresh
Grid1.Refresh
for select
Dim con As ADODB.Connectio n
Dim rs As ADODB.Recordset
Dim strconnect As String
Set con = New ADODB.Connectio n
Set rs = New ADODB.Recordset
strconnect = "Driver={SQ L Server};Server= FOCUSSERVER;Dat abase=Northwind ;Uid=sa;"
con.Open strconnect
rs.Open "select * from Sales", con, adOpenDynamic, adLockOptimisti c
MsgBox "Connected Suceesfully"
'for delete
rs.Delete
MsgBox "You suceesfully deleted the record"
rs.MoveFirst
Adodc1.Refresh
[/code]
can anyone plz tell me what changes should i do in above codings or send me some sample coding plz urgent
Comment