Lots of Data :-(
- From: "greg4168@xxxxxxxxx" <greg4168@xxxxxxxxx>
- Date: 10 Nov 2005 13:23:08 -0800
Hello -
I wrote a simple Visual Basic 6 program that updates a SQL Server table
with a small stream of text. The problem I'm having is that, even
though it's only about 100 characters of text I'm sending, the
transaction is about 2.5mb in size. I can tell this with a sniffer
trace, but I can't figure out what extra information is being sent to
make the transfer size so large.
The other problem I'm having involves using FIND to find the record
before I write it, because I want to update the record if it already
exists. If it doesn't already exist I create a new record. According
to the sniffer trace, the FIND command is returning all of the data in
the entire SQL table. Can't I just find a record in the table without
returning all of the records in the entire table?
Here's the code I'm using:
' Create the connect string from user supplied values
strConnect = "Provider=SQLOLEDB.1" _
& ";User ID=" & txtUID _
& ";Password=" & txtPWD _
& ";Initial Catalog=" & txtDatabase _
& ";Data Source=" & txtServer _
& ";Network Library=DBMSSOCN"
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
' Open the connection.
Set cnn = New ADODB.Connection
With cnn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open strConnect
End With
Set rst = New ADODB.Recordset
With rst
' Open the table by using a scrolling Recordset object.
.Open Source:=txttable, _
ActiveConnection:=cnn, _
CursorType:=adOpenKeyset, _
LockType:=adLockOptimistic
.Find ("compname LIKE '" & vbcompname & "%'")
If .EOF Then
.AddNew
End If
!DateTime = vbdatetime
!compname = LCase(vbcompname)
.Update
.Close
.Filter = adFilterNone
Set rst = Nothing
End With
Thanks very much,
Greg.
.
- Follow-Ups:
- Re: Lots of Data :-(
- From: Stephen Howe
- Re: Lots of Data :-(
- From: beginthreadex
- Re: Lots of Data :-(
- Prev by Date: Re: Microsoft Access and Transaction Isolation Level
- Next by Date: Re: Lots of Data :-(
- Previous by thread: RE: Microsoft Access and Transaction Isolation Level
- Next by thread: Re: Lots of Data :-(
- Index(es):
Relevant Pages
|
|