Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB and SQL7

Status
Not open for further replies.

randusoleis

IS-IT--Management
May 11, 2001
43
0
0
US
I have just started writing in VB6 and am so far self taught. I need some insight on writing in VB for accessing, update, delete from a SQL7 database.
 
You are working with a much better database than Access.
SQL Server 7 is robust, great for the corporate world.
I use VB6 and SS7 in an industrial-strength shipping system handling over 5000 units per day.
These examples are from forms using the 3rd party True DB Grid... so you will want to replace "truSpurs" with whatever...
Like you, I had to learn it on my own.
Good luck; these forums can help you get started.
Here is some sample code:
John


' find the spur that we are looking for

142 Set rsSpurs = Cn.OpenResultset("SELECT * FROM Spur WHERE SpurNumber = '" & Val(truSpurs.Columns(SPUR_NUMBER).Value) & "'", Type:=rdOpenDynamic, LockType:=rdConcurRowVer)


‘ update the Spur row

If Val(truSpurs.Columns(SPUR_PRIORITY).Value) <> rsSpurs(&quot;SpurPriority&quot;) Or Val(truSpurs.Columns(TRAILER_CAPACITY).Value) <> rsSpurs(&quot;TrailerCapacity&quot;) Or (truSpurs.Columns(TRAILER_NUMBER).Value) <> rsSpurs(&quot;TrailerId&quot;) Or gbConstraintChange Then
161 Cn.Execute &quot;Begin Transaction&quot;, rdExecDirect
162 rsSpurs.Edit
' change constraint information if appropriate
163 If gbConstraintChange Then
164 SaveConstraintArray rsSpurs(&quot;SpurNumber&quot;)
165 rsSpurs(&quot;Constrained&quot;) = IsSpurConstrained(rsSpurs(&quot;SpurNumber&quot;))
End If
166 rsSpurs(&quot;SpurPriority&quot;) = Val(truSpurs.Columns(SPUR_PRIORITY).Value)
167 rsSpurs(&quot;TrailerCapacity&quot;) = Val(truSpurs.Columns(TRAILER_CAPACITY).Value)
168 rsSpurs(&quot;TrailerId&quot;) = sTrNumber
169 rsSpurs.Update
170 Cn.Execute &quot;Commit Transaction&quot;, rdExecDirect


 
I've been using ADO for my database accessing. Wrox published a great book on it, written by David Sussman called ADO 2.6 Programmer's Reference. I highly recommend it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top