A SQL Server DB table named LMST has 2 fields - LCode (int) & LName (varchar(50)). Now suppose I have the following ASP code:
<%
Dim strSQL
strSQL="SELECT LCode,LName FROM LMST"
Set objRS.Open=objConn.Execute(strSQL)
Dim strType1,strType2
strType1=objRS("LCode"
.Type
strType2=objRS("LName"
.Type
Response.Write(strType1 & ", "
Response.Write(TypeName(strType1) & "<br><br>"
Response.Write(strType2 & ", "
Response.Write(TypeName(strType2) & "<br><br>"
Response.Write(VarType(objRS("LCode"
) & ", "
Response.Write(TypeName(objRS("LCode"
))
Response.Write(VarType(objRS("LName"
) & ", "
Response.Write(TypeName(objRS("LName"
))
%>
The above code, when executed, produces the following result:
5, Long
202, Long
5, Field
8, Field
What does objRS("LCode"
.Type & objRS("LName"
do? Don't they give the datatype of the fields? Why is strType1 & strType2 showing 5 & 202 respectively though the TypeName shows Long for both strType1 & strType2? Also when VarType(objRS("LCode"
) is producing 5 (for vbDouble), why isn't TypeName(objRS("LCode"
showing the datatype of the field LCode but instead showing 'Field'?
Thanks,
Arpan
<%
Dim strSQL
strSQL="SELECT LCode,LName FROM LMST"
Set objRS.Open=objConn.Execute(strSQL)
Dim strType1,strType2
strType1=objRS("LCode"
strType2=objRS("LName"
Response.Write(strType1 & ", "
Response.Write(TypeName(strType1) & "<br><br>"
Response.Write(strType2 & ", "
Response.Write(TypeName(strType2) & "<br><br>"
Response.Write(VarType(objRS("LCode"
Response.Write(TypeName(objRS("LCode"
Response.Write(VarType(objRS("LName"
Response.Write(TypeName(objRS("LName"
%>
The above code, when executed, produces the following result:
5, Long
202, Long
5, Field
8, Field
What does objRS("LCode"
Thanks,
Arpan