Re: Lots of Data :-(
- From: beginthreadex <beginthreadex@xxxxxxxxxxx>
- Date: Thu, 10 Nov 2005 21:35:20 +0000
> I wrote a simple Visual Basic 6 program that updates a SQL Server table
> with a small stream of text.
I presume that you do not mean a defined "stream" but rather a string of
text that might be able 100 char.
> 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.
It sounds like you are using ADO functionality for friendly needs and you
might want to check out using TSQL instead.
> 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?
Use something like this ... this will check for the existance of your record
and either do an update or an insert as needed. No need to mess with the
faulty FIND method.
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strSQL as String
Dim varReturn as Variant
Set cnn = New ADODB.Connection
With cnn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open "Provider=SQLOLEDB.1;User ID=" & txtUID & ";Password=" & txtPWD &
";Initial Catalog=" & txtDatabase & ";Data Source=" & txtServer &
";Network Library=DBMSSOCN"
End With
set rst = cnn.Execute("select count(*) from " & txttable & " where compname
like '" & vbcompname & "%'")
if rst.EOF
cnn.Execute "insert into " & txttable & " (field_x) select 'asdf'"
else
cnn.Execute "update " & txttable & " set field_x = 'asdf'"
end if
rst.Close
cnn.Close
set rst = Nothing
set cnn = Nothing
.
- References:
- Lots of Data :-(
- From: greg4168@xxxxxxxxx
- Lots of Data :-(
- Prev by Date: Lots of Data :-(
- Next by Date: Re: CADORecordBinding ... adDate
- Previous by thread: Lots of Data :-(
- Next by thread: Re: Lots of Data :-(
- Index(es):
Relevant Pages
|
|