Discussion Locked

USING ADO WITH VISUAL BASIC

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

HOW CAN SEEK ADO WITH VISUAL BASIC

WHEN USING SQL SERVER DATABSE I CANNOT SEEK ADO INDEXED FILEDS IT WILL GETTING ERROR
HOW CAN IT POSSIBLE
IF HAVE ANOTHER METHOD TO FAST SEEK ON USING
VB LIKE ACESS DATABASE ON SQLSERVER DATABASE

2 replies

by fenaikh

Hi
these 7 parts may help you and there links.

good luck

Mohamed

Visual Basic Database Tutorial - Part 1
http://www.vb-world.com/databases/dbtutorial/

Quick Start Guide to SQL Server 7 - Part 2 http://www.vb-world.com/databases/sqltutorial2/

Quick Start Guide to SQL Server 7 - Part 3

http://www.vb-world.com/databases/sqltutorial3/

Quick Start Guide to SQL Server 7 - Part 4

http://www.vb-world.com/databases/sqltutorial4

Quick Start Guide to SQL Server 7 - Part 5
http://www.vb-world.com/databases/sqltutorial5

Quick Start Guide to SQL Server 7 - Part 6
http://www.vb-world.com/databases/sqltutorial6

Quick Start Guide to SQL Server 7 - Part 7
http://www.vb-world.com/databases/sqltutorial7

by fenaikh

more...

http://www.vb-world.com/databases/sqltutorial4/index2.html

Visual Basic Code

Private Sub Command1_Click()

Dim objConn As New ADODB.Connection
Dim objRS As New ADODB.Recordset

'Objects to be used in this operation -'objConn, the basic connection
'objRS, to hold our recordset

With objConn
.ConnectionString = "Driver=SQL Server;Server=COLOSSI;" & _
"Database=PUBS;User ID=KarlMoore;Password=TEST"
.Open
End With

'Get a connection to the database

objConn.BeginTrans

'Begin Transactions here!

objRS.Open "Select * from Jobs", objConn

'Open the recordset, selecting all from the Jobs table

objRS.AddNew
objRS.Fields("job_desc") = "My New Test Job"
objRS.Fields("min_lvl") = 10
objRS.Fields("max_lvl") = 20
objRS.Update

'Add a new record... and then...

objRS.AddNew
objRS.Fields("job_desc") = "My Second New Test Job"
objRS.Fields("min_lvl") = 20
objRS.Fields("max_lvl") = 30
objRS.Update

'... another!

If MsgBox("Do you want to commit?", vbYesNo + vbQuestion) = vbYes Then
objConn.CommitTrans
Else
objConn.RollbackTrans
End If

'Run the CommitTrans or RollbackTrans methods,
'depending on user response

objRS.Close
Set objRS = Nothing
objConn.Close
SetobjConn = Nothing

'Close all references

End Sub

This discussion is closed to new replies.