TechMonster
asked on
write to sql database using asp.net
My mind is having a hard time just getting started using ADO.NET. I am using Sharepoint designer so all I have is just a aspx page.
How would I use ado.net to write a text field to a database? There are several code examples but none seem to be the correct syntex I need for the below code.
Thanks
How would I use ado.net to write a text field to a database? There are several code examples but none seem to be the correct syntex I need for the below code.
Thanks
<%@ Page Language="C#" %>
<html dir="ltr" xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<head runat="server">
<META name="WebPartPageExpansion" content="full">
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:PublishingContactPicture msdt:dt="string">, </mso:PublishingContactPicture><mso:PublishingContact msdt:dt="string"></mso:PublishingContact></mso:CustomDocumentProperties></xml><![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled 1</title>
</head>
<body>
<label id="lblFirstName">First Name </label> <textarea name="txtFirstName" id="txtFirstName"></textarea>
<br>
<label id="lblLastName">Last Name </label> <textarea name="txtLastName" id="txtLastName"></textarea>
<br>
<label id="lblAnswer">Answer </label> <textarea name="txtAnswer" id="txtAnswer"></textarea>
<br>
<label id="lblOpt">Selected Option</label> <textarea name="txtOpt" id="txtOpt"></textarea>
<SCRIPT type ="text/javascript">
function qs() {
var qsParm=new Array();
var query = window.location.search.substring(1);
var parms = query.split('&');
for (var indx=0; indx<parms.length; indx++) {
var pos = parms[indx].indexOf('=');
if (pos > 0) {
var key = parms[indx].substring(0,pos);
var val = parms[indx].substring(pos+1);
qsParm[key] = val;
}
}
return qsParm;
}
var info=qs();
var firstname = info['fn'];
var lastname = info['ln'];
var ans = info['ans'];
var opt = info['opt'];
document.getElementById("txtFirstName").value = firstname;
document.getElementById("txtLastName").value = lastname;
document.getElementById("txtAnswer").value = ans;
document.getElementById("txtOpt").value = opt;
</script>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the response