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

Read database from VBScript 1

Status
Not open for further replies.

Charlix

Programmer
Nov 19, 2002
85
US

Hi:
Could someone explain why I can recover only numeric values from my database on an ASP page when I enclose the code within <SCRIPT LANGUAGE=&quot;VBScript&quot;> </SCript but can recover both numbers and letters when I enclose the code withing <% %> as in the following code snippet.
---------------------------

<% Dim rs, conn, sql

Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
conn = &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot; & &quot;Data Source=C:\Test1.mdb&quot;
sql = &quot;SELECT * FROM [TestTable]&quot;

rs.open sql, conn %>

<SCRIPT LANGUAGE=&quot;VBScript&quot;>
MsgBox <% = rs(&quot;Name&quot;) %>
</SCRIPT>

<% Response.Write rs(&quot;Name&quot;) %>

-------------------------
The MsgBox is blank whenever there is a letter or letter combination in value of &quot;Name&quot;. However, Response.Write returns the value of &quot;Name&quot; all the time.

Thanks,

Charlix
 
i think you need &quot;'s in the MSgBox (
This way:

<SCRIPT LANGUAGE=&quot;VBScript&quot;>
MsgBox &quot;<% = rs(&quot;Name&quot;) %>&quot;
</SCRIPT>


hth,
Foxbox
ttmug.gif
 
Thanks foxbox,
The quotes solved the problem.
Thanks again,
Charlix
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top