hi there,
im having problem with the whole codings here. i can't execute the programme.please help.tell me whats my mistake. i need to connect it to the microsoft sql server
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script type="text/javascript">
function SelectAll(id){
var frm =document.forms[0];
for(id=0;id<frm.elements.length;i++){
if(frm.elements[i].type=="checkbox"){
frm.elements[i].checked-document.getElementById(id).checked;
}
}
}
</script>
<asp:Gridview Id="Gridview1" runat="server" DataSourceID="SqlDataSource1">
<columns>
<asp:TemplateField>
<AlternatingItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server"/>
</AlternatingItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat ="server"/>
</ItemTemplate>
<HeaderStyle HorizontalAlign="left" />
<ItemStyle Horizontalalign="left" />
</asp:TemplateField>
</columns>
</asp:Gridview>
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim MyConnection As SqlConnection
Dim MyCommand As SqlCommand
MyConnection = New SqlConnection()
MyConnection.ConnectionString = _
ConfigurationManager.ConnectionStrings("MainConnStr").ConnectionString
Dim str As String = "insert into Registration(AccountNum, ContactPerson , FaxNum, City, Poskod,Address,EmailAdd,H/Pnum,State) " + "values ('" &TextBox1.Text& "','" &TextBox2.Text& "','" &TextBox3.Text& "','" &TextBox4.Text& "','" &TextBox5.Text& "','" &TextBox6.Text& "','" &TextBox7.Text& "','" & TextBox8.Text & "','" & TextBox9.Text & "');"
MyCommand = New SqlCommand
End Sub
Protected Sub Gridview1_RowDataBound(ByVal sender As Object,ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs e){
If (e.Row.RowType = DataControlRowType.Header) Then
'adding an attribute for onclick event on the check box header
'and passing the ClientID of the Select All checkbox
DirectCast(e.Row.FindControl("CheckBox1"), CheckBox).Attributes.Add)"OnClick","javascript.SelectAll('" + ((CheckBox1)
e.Row.FindControl("CheckBox1"), CheckBox).ClientID & "')");
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<p>
<br />
</p>
<form id="form1" runat="server">
<div>
<br />
<br />
<br />
PICK UP FORM</div>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
Account Number
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</p>
<p>
Contact Person
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</p>
<p>
Fax Number
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</p>
<p>
City
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
</p>
<p>
Poskod
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
</p>
<p>
Address
<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
</p>
<p>
Email address
<asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
</p>
<p>
Phone Number
<asp:TextBox ID="TextBox8" runat="server"></asp:TextBox>
</p>
<p>
State
<asp:TextBox ID="TextBox9" runat="server"></asp:TextBox>
</p>
<p>
E Shipping
<asp:CheckBox ID="CheckBox1" runat="server" />
</p>
<asp:Button ID="Button1" runat="server" Text="Button" Width="84px" />
</form>
</body>
</html>