hi
i've a find page wherein you have to enter a name and find the address for the name in the database .
i've to first validate in the client side if the textbox is left empty and if not then connect to the database and find the record.
i've created a textbox and a find button and in the onclick event i call the function check which checks if the text box is blank properly.
but how do i write the else part where i've to connect and search the database.
<script language=vbscript>
sub check()
if document.find.text1.value="" then
msgbox "Enter some name to find the corresponding
address."
else
<%
session("Connection"= "Provider=SQLOLEDB.1;Persist
Security Info=False;User ID=sa;Initial
Catalog=EPersonalAssistant;Data Source=GANUSHA-
HS4QTTQ"
dim objconn,objrs,strSql,strName
set objconn=server.CreateObject("adodb.connection"
objconn.Open session("Connection"
set objrs=server.CreateObject("adodb.recordset"
strSql="select * from addressbook where name ??
objrs.Open strSql,objconn
%>
end if
end sub
</script>
i've a find page wherein you have to enter a name and find the address for the name in the database .
i've to first validate in the client side if the textbox is left empty and if not then connect to the database and find the record.
i've created a textbox and a find button and in the onclick event i call the function check which checks if the text box is blank properly.
but how do i write the else part where i've to connect and search the database.
<script language=vbscript>
sub check()
if document.find.text1.value="" then
msgbox "Enter some name to find the corresponding
address."
else
<%
session("Connection"= "Provider=SQLOLEDB.1;Persist
Security Info=False;User ID=sa;Initial
Catalog=EPersonalAssistant;Data Source=GANUSHA-
HS4QTTQ"
dim objconn,objrs,strSql,strName
set objconn=server.CreateObject("adodb.connection"
objconn.Open session("Connection"
set objrs=server.CreateObject("adodb.recordset"
strSql="select * from addressbook where name ??
objrs.Open strSql,objconn
%>
end if
end sub
</script>