S
Sebastian Kenny
I'm new to VB.NET. I'm usging an SQL select join in the following way:
----------------
strConn = Application.Get("DB_CONNECTION_STRING")
Dim MySQL As String
MySQL = "Select * from Users u, Banks b where u.UserID=? and b.BankID =
u.BankID"
Dim MyConn As New Odbc.OdbcConnection(strConn)
Dim Cmd As New Odbc.OdbcDataAdapter(MySQL, MyConn)
Cmd.SelectCommand.Parameters.Add("MemberID",System.Data.Odbc.OdbcType.Int).Value
= iUserID
Dim ds As DataSet = New DataSet
Cmd.Fill(ds)
Dim dr As DataRow
dr = ds.Tables(0).Rows(0)
----------------
It works fine, but I have a problem. If both tables have a field of the
same name (e.g. DATECREATED), I assumed that I could use (eg):
dr("u.DATECREATED")
to access a specific column, but it isn't working.
Can anyone tell me how to do this?
Thanks
Seb
----------------
strConn = Application.Get("DB_CONNECTION_STRING")
Dim MySQL As String
MySQL = "Select * from Users u, Banks b where u.UserID=? and b.BankID =
u.BankID"
Dim MyConn As New Odbc.OdbcConnection(strConn)
Dim Cmd As New Odbc.OdbcDataAdapter(MySQL, MyConn)
Cmd.SelectCommand.Parameters.Add("MemberID",System.Data.Odbc.OdbcType.Int).Value
= iUserID
Dim ds As DataSet = New DataSet
Cmd.Fill(ds)
Dim dr As DataRow
dr = ds.Tables(0).Rows(0)
----------------
It works fine, but I have a problem. If both tables have a field of the
same name (e.g. DATECREATED), I assumed that I could use (eg):
dr("u.DATECREATED")
to access a specific column, but it isn't working.
Can anyone tell me how to do this?
Thanks
Seb