Thread: query problem
View Single Post
  #8 (permalink)  
Old September 9th, 2003, 11:58 PM
mateenmohd mateenmohd is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: abu dbabi, , United Arab Emirates.
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for response.
I use msgbox but it give following error.

Error Type:
Microsoft VBScript runtime (0x800A0046)
Permission denied: 'msgbox'
/dcil2/tripimages/contno2ab.asp, line 107

I am using following coding.
How can use the recordset in the query ?
how can display number of records retrieve by query ?



set cn=server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
cn.ConnectionString="Provider=SQLOLEDB.1;Integrate d Security=SSPI;Persist Security Info=False;Initial Catalog=dcil;Data Source=dcil2"
cn.Open

contractno=Request.Form("contractno")
contractno1=Request.Form("contractno1")

ssql=contractno+contractno1

if ssql=contractno then

rs.Open "SELECT contractno,recordno,category,contractor,consultant ,Description,drawingno,approveddate,quickviewrefer ence FROM arc where contractno='" & contractno & "' order by recordno",cn,1,2
rs.PageSize=100

if rs.BOF = True and rs.EOF = True then
msgbox "error retrieving recordset. description =" & Err.Description
else
msgbox "column 1 returned is " & rs.Fields(0) // line 107

end if

Response.Write("Total No of Records = "& rs.RecordCount&"<br>")



Mateen







Quote:
quote:Originally posted by nbryson
 Hi

You need to replace 'raise error' and 'work with recordset' text with you own code.

if rs.BOF = True and rs.EOF = True then
raise error
else
work with recordset
end if

The error that was raised 'Microsoft VBScript compilation (0x800A03EA)
Syntax error
/dcil2/paging7.asp, line 25, column 5
work with recordset' could not compile your application as it is just text.

Just to give you an idea replace the above code with :-
if rs.BOF = True and rs.EOF = True then
msgbox "Error retrieving recordset. description = " & Err.Description
else
msgbox "Column 1 returned is " & rs.fields(0)
end if

See how you get on.

Nickie
Reply With Quote