469,626 Members | 1,615 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

Accessing a database VB6 style...



I'm a veteran VB6 programmer venturing up to C#. I have seen a ton of
examples of C# using different techniques for accessing a SQL database but I
was wondering if there is a way to work with a database much like we did
using ADO under VB6? I guess I'm looking for the simplicity of being able
to do an update or insert without having to write all the SQL to go with it.

Here is a very common example of what I'm trying to emulate in C#:

DIM rsInvoiceTransCodesAccess as new ADODB.Recordset

If rsInvoiceTransCodesAccess.State = 1 Then
strSQLAccess = "SELECT * FROM Invoice.dbo.InvoiceTransCodes
WHERE CompanyID = '" & strTPCompanyID & "' and Code = '9997'"
rsInvoiceTransCodesAccess.Open strSQLAccess, cnGlobal,
adOpenStatic, adLockOptimistic

If rsInvoiceTransCodesAccess.EOF = True Then
End If

rsInvoiceTransCodesAccess("CompanyID").value = strCompanyID
rsInvoiceTransCodesAccess("CompanyName").value = strCompanyName

End If
It handles the insert or update based on the currently loaded record.

Thanks for the help,
Mar 2 '06 #1
0 890

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Tim Blackwell | last post: by
3 posts views Thread by joealey2003 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.