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

How read a database value into vbscript variable?

Status
Not open for further replies.

seidel

Programmer
Oct 23, 2002
10
MX
Hello!
I have a database, I need read values form this database into vbscript variables!!!! please helpme

example:

my database have 2 fields: ID, price

how assign into variable "sum" the value from price?

"sum is a varible into vbscript thanks
 
Using ASP: (I'm sure this can be also done with PHP)

<% 'Fragmented code below. If you don't know ASP/ Learn it!
dim yourValue

'Database query
SQL=&quot;Select ID,Fname from SomeTable&quot;

'create recordset
set objRec=server.createobject(&quot;ADODB.recordset&quot;)

'set recordset
objRec.open objConn.execute(<your SQL code>)

'set ASP variable
yourValue=objRec(&quot;ID&quot;)
%>

<HTML>
<HEAD>
<Script language=vbscript>
dim yourVariable

'this is how you would assign the database field
'to your vbscript variable
yourVariable=<%=yourValue%>
</Script>
</Head>
<BODY>
</BODY>
</HTML>



&quot;did you just say Minkey?, yes that's what I said.&quot;

MrGreed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top