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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help with SQL

Status
Not open for further replies.

purplehaze1

Programmer
Jul 23, 2003
86
US
How can I write the following code in vb.Net? Thanks.


Set adoRs = New ADODB.Recordset

strSQL = "Select * FROM Employees a WHERE a.EmployeeID=" & m_OldEmployeeID & ""
adoRs.Open strSQL, Conn, adOpenKeyset, adLockOptimistic
With adoRs
If Not .EOF Then
If m_IsDeleted Then
.Delete
Else
SaveRecord:
adoRs("Address") = IIf(m_Address = vbNullString, vbNullString, m_Address)
adoRs("BillingRate") = m_BillingRate
adoRs("City") = IIf(m_City = vbNullString, vbNullString, m_City)
adoRs("Country") = IIf(m_Country = vbNullString, vbNullString, m_Country)
adoRs("Extension") = IIf(m_Extension = vbNullString, vbNullString, m_Extension)
adoRs("FirstName") = IIf(m_FirstName = vbNullString, vbNullString, m_FirstName)
adoRs("LastName") = IIf(m_LastName = vbNullString, vbNullString, m_LastName)
adoRs("PostalCode") = IIf(m_PostalCode = vbNullString, vbNullString, m_PostalCode)
adoRs("StateOrProvince") = IIf(m_StateOrProvince = vbNullString, vbNullString, m_StateOrProvince)
adoRs("Title") = IIf(m_Title = vbNullString, vbNullString, m_Title)
adoRs("WorkPhone") = IIf(m_WorkPhone = vbNullString, vbNullString, m_WorkPhone)

.Update
m_EmployeeID = adoRs("EmployeeID")
m_OldEmployeeID = m_EmployeeID
End If
Else
If Not m_IsDeleted Then
.AddNew
GoTo SaveRecord
End If
End If
.Close
End With
 
Try running the VB6 to VB.NET conversion wizard and see what it produces.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top