troubleshooting Question

write to sql database using asp.net

Avatar of TechMonster
TechMonster asked on
JavaScriptASP.NETMicrosoft SharePoint
2 Comments1 Solution143 ViewsLast Modified:
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
<%@ 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>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros