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!

Returning SQL query results as a string

Status
Not open for further replies.

ants211

Technical User
Feb 22, 2002
15
GB
Hi, I want to create a string i.e. strFaultid as a result of an sql query.

The SQL returns a value dependent on the input of the user in the previous form. The SQL statement is as follows:

Select faultid from fault where category=""&strCategory&"" and category_sub=""&strCategory_sub&""

The category and category_sub strings are passed in from the previous form. I would like to create a faultid string as a result of this query so I can populate a table with the value.

Any help is appreciated.

 
Are you only expecting one faultid to be returned or several? If it is only one then you can use something like this:

Code:
'(open connection called conn)

strSQL = "SELECT faultid FROM fault WHERE category = '" & strCategory & "' AND category_sub = '" & strCategory_sub & "'"

rs = conn.Execute(strSQL)

strFaultID = rs("faultid")

Or do you expect multiple values to be returned from the query? if so, what format do you want your string to take?
 
try using the CStr function ---------------------------------------
{ str = "sleep is good for you. sleep gives you the energy you need to function";
ptr = /sleep/gi;Nstr = str.replace(ptr,"coffee");alert(Nstr); }
---------------------------------------
for the best results to your questions: FAQ333-2924

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top