Hi all:
I am new to ASP.NET (VB side )
But I have javascript code plus SQL Database connection and need to update the recordset with the value it populates into 2 textboxes.
Now I have no idea how to do that .... Can someone help..
Below is the structure to my code on my ASP page
Thanks
Shan
I am new to ASP.NET (VB side )
But I have javascript code plus SQL Database connection and need to update the recordset with the value it populates into 2 textboxes.
Now I have no idea how to do that .... Can someone help..
Below is the structure to my code on my ASP page
Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head runat="server">
<script type="text/javascript">
var lat;
var longi;
function addM()
{
document.getElementById("gf"').value = lat ;
document.getElementById("fg").value = longi ;
}
function showLocation(address)
{
addM(address);
Blah blah;
}
</script>
<title>Untitled Page</title>
</head>
<body onload="initLoader();">
<script runat="server">
Sub Page_Load()
Dim objConnect As SqlConnection
Dim objCommand As SqlCommandDim objDataReader As SqlDataReader
objConnect = New SqlConnection(connectionString:="Server=XXX;Database=XXX;uid=XX;password=XX")
objConnect.Open()
objCommand = New SqlCommand("Select LocationId,XXX,YYY,(Rtrim(SF_STREET) + ',' + RTRim(SF_City) + ',' + RTrim(SF_State) + ' ' + RTrim(SF_Zip)) As 'Address' from SF_Locations where LocationId=110", objConnect)
objDataReader = objCommand.ExecuteReader()
'Start the form here
Response.Write("<form id=""form1"" action=""#"" onsubmit=""showLocation(); return false;"">")
Response.Write("<p>")
Response.Write("<b>Click on the Address to see Latitude and Longitude:</b>")
''Loop through the recordset
While objDataReader.Read()
Response.Write("<a href=""javascript:void(0)"" onclick=""showLocation('" + objDataReader("Address") + "');return true;"">" + objDataReader("Address") + "</a>")
Response.Write("<input id=""gf"" type=""text"" value=""0"" />")
Response.Write("<input id=""fg"" type=""text"" value=""0"" />")
End While
Response.Write("<p></form>")
Response.Write("<div id=""like"" style=""width: 500px; height: 300px""></div>")
'Close all objects, data objects and all so no connection is left open
objDataReader.Close()
objDataReader = Nothing
objCommand.Dispose()
objCommand = Nothing
objConnect.Close()
objConnect = Nothing
End Sub
</script>
<% Page_Load %>
</body>
</html>
Shan