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

VB6 to VBScript Conversion

Status
Not open for further replies.

Linguist

Technical User
Jul 11, 2000
40
0
0
US
I urgently need your help.

I am trying to convert the following VB6 routine to VBScript:

----------------------------------

Dim Answer
If Trim(txtSearch.Text) = "" Then
Answer = MsgBox("Need String Search, Please", vbOKOnly + vbCritical, "Warning")
Exit Sub
End If
datPrimaryRS.RecordSource = "SELECT * FROM Catalog WHERE Author LIKE '%" & txtSearch.Text & "%'"
On Error Resume Next
datPrimaryRS.Refresh
datPrimaryRS.Recordset.MoveLast: datPrimaryRS.Recordset.MoveFirst

---------------------------------------

I would appreciate any and all suggestions.

Thanks
 
well, you can't use the msgbox in asp. This is asp right? If it's not the database (RS) will not be possible client side.
anyway, this is what I came up with
'''''your new connection''''''
Dim ObjConn
Dim rs
Dim strConn
Set ObjConn = Server.CreateObject("ADODB.Connection")
strConn="Driver=Microsoft Access Driver (*.mdb); DBQ=" & server.mappath("/DBname.mdb")& ";"
ObjConn.Open strConn
Set RS = Server.CreateObject("ADODB.Recordset")

''''conversion below'''''''
Dim Answer, search
search = form.txtsearch.value 'this comes from a form now??
If Trim(search) = "" Then
Response.Write "Need String Search, Please" 'write error
'you do not have a sub any longer --- no need to exit
else
RS.open "SELECT * FROM Catalog WHERE Author LIKE '" & search & "'", ObjConn
'here's where you'll exucute that sql statement
end if You cannot mandate productivity, you must provide the tools to let people become their best.
-Steve Jobs
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top