I am trying to pull data from two tables by joining the tables and I am getting errors. I can pull the required columns from the tables individually but when I join them the command always fails no matter if I use a JOIN command or just use a where clause. I don't specify any locks, cursortypes or cursorlocations in my connection string and I am wondering if it is anything to do with this. I have enclosed my code and the resultant output below:
Code:
<%
' Connect to the database to get a list of the products for the customer
Dim Connect, rs, objdbconn, sql1, sql2, sql3
Connect = "Provider=BtrvProv;Data Source=E:\Users\elliottn\maxdat;Provider String = " & _
"'INTERNAL_SQL_SUPPORT=3'"
Set objdbconn = Server.CreateObject( "ADODB.Connection" )
objdbconn.Open Connect
' Create a recordset object
Set rs = Server.CreateObject("ADODB.Recordset"
rs.ActiveConnection = objdbconn
sql1 = "SELECT PRTNUM_01, PMDES1_01 from Prtmst"
sql2 = "SELECT QTYOH_06 from PRTSTK WHERE NETFLG_06 = 'Y'"
sql3 = "SELECT Prtmst.PRTNUM_01, Prtmst.PMDES1_01, PRTSTK.QTYOH_06 FROM Prtmst,"
sql3 = sql3 + "PRTSTK WHERE Prtmst.PRTNUM_01 = PRTSTK.PRTNUM_06 AND PRTSTK.NETFLG_06 = 'Y'"
response.write "SQL1: " & sql1 & vbcrlf
rs.Open sql1
response.write "sql1 was successful" & vbcrlf & vbcrlf
rs.close
response.write "SQL2: " & sql2 & vbcrlf
rs.Open sql2
response.write "sql2 was successful" & vbcrlf
rs.close
response.write "SQL3: " & sql3 & vbcrlf
rs.Open sql3
response.write "sql3 was successful" & vbcrlf & vbcrlf
rs.close
set rs = nothing : objdbconn.close : set objdbconn = nothing
%>
OUTPUT:
SQL1: SELECT PRTNUM_01, PMDES1_01 from Prtmst
sql1 was successful
SQL2: SELECT QTYOH_06 from PRTSTK WHERE NETFLG_06 = 'Y'
sql2 was successful
SQL3: SELECT Prtmst.PRTNUM_01, Prtmst.PMDES1_01, PRTSTK.QTYOH_06 FROM Prtmst,PRTSTK WHERE Prtmst.PRTNUM_01 = PRTSTK.PRTNUM_06 AND PRTSTK.NETFLG_06 = 'Y'
Provider error '80004004'
Operation aborted
/clientarea/stckquery.asp, line 39
Mise Le Meas,
Mighty
Code:
<%
' Connect to the database to get a list of the products for the customer
Dim Connect, rs, objdbconn, sql1, sql2, sql3
Connect = "Provider=BtrvProv;Data Source=E:\Users\elliottn\maxdat;Provider String = " & _
"'INTERNAL_SQL_SUPPORT=3'"
Set objdbconn = Server.CreateObject( "ADODB.Connection" )
objdbconn.Open Connect
' Create a recordset object
Set rs = Server.CreateObject("ADODB.Recordset"
rs.ActiveConnection = objdbconn
sql1 = "SELECT PRTNUM_01, PMDES1_01 from Prtmst"
sql2 = "SELECT QTYOH_06 from PRTSTK WHERE NETFLG_06 = 'Y'"
sql3 = "SELECT Prtmst.PRTNUM_01, Prtmst.PMDES1_01, PRTSTK.QTYOH_06 FROM Prtmst,"
sql3 = sql3 + "PRTSTK WHERE Prtmst.PRTNUM_01 = PRTSTK.PRTNUM_06 AND PRTSTK.NETFLG_06 = 'Y'"
response.write "SQL1: " & sql1 & vbcrlf
rs.Open sql1
response.write "sql1 was successful" & vbcrlf & vbcrlf
rs.close
response.write "SQL2: " & sql2 & vbcrlf
rs.Open sql2
response.write "sql2 was successful" & vbcrlf
rs.close
response.write "SQL3: " & sql3 & vbcrlf
rs.Open sql3
response.write "sql3 was successful" & vbcrlf & vbcrlf
rs.close
set rs = nothing : objdbconn.close : set objdbconn = nothing
%>
OUTPUT:
SQL1: SELECT PRTNUM_01, PMDES1_01 from Prtmst
sql1 was successful
SQL2: SELECT QTYOH_06 from PRTSTK WHERE NETFLG_06 = 'Y'
sql2 was successful
SQL3: SELECT Prtmst.PRTNUM_01, Prtmst.PMDES1_01, PRTSTK.QTYOH_06 FROM Prtmst,PRTSTK WHERE Prtmst.PRTNUM_01 = PRTSTK.PRTNUM_06 AND PRTSTK.NETFLG_06 = 'Y'
Provider error '80004004'
Operation aborted
/clientarea/stckquery.asp, line 39
Mise Le Meas,
Mighty