Can anyone tell me why I'm getting this error message? See code below followed by full error:
<%@ Page language="
vb" Codebehind="demo.aspx.cs" AutoEventWireup="false" Inherits="spaw.spaw.samples.demo" ValidateRequest="false" %>
<%@ Register TagPrefix="spaw" TagName="Spaw" Src="../spaw/spaw.ascx" %>
<%@Import NameSpace = "System.Data" %>
<%@Import NameSpace = "System.Data.SqlClient" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script language="
VB" runat="server">
sub Page_Load()
if Page.IsPostback then
Dim strSQL As String
Dim strConnection As String
Dim objConnection As New SqlConnection
Dim objCommand As New SqlCommand
Dim txtTitle As String
Dim txtText As String
Dim txtParent As String
Dim txtPath As String
Title.Text = txtTitle
Spaw1.Text = txtText
Parent.Text = txtParent
Path.Text = txtPath
strConnection = "server=localhost;database=celink;User ID=sa;Password=ecom1091"
strSQL = "insert into tbl_articles Values ('"&(txtTitle)&"','"&(txtText)&"','"&(txtParent)&" ','"&(txtPath)&"');"
objConnection = New SqlConnection(strConnection)
objConnection.Open()
objCommand = New SqlCommand(strSQL, objconnection)
objCommand.ExecuteNonQuery()
end if
end sub
</script>
<html>
<head>
<title>CeLink Data Entry</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<Form runat="server">
Article Title: <asp:textbox ID="Title" Text="replace" runat="server"/><br><br>
Parent Link: <asp:textbox ID="Parent" Text="replace" runat="server"/><br><br>
File Path: <asp:textbox ID="Path" Text="replace" runat="server"/><br><br>
<spaw:Spaw id="Spaw1" Width="600px" Text="replace" runat="server"/><br><br>
<input type="submit">
</Form>
</body>
</html>
error:
[NullReferenceException: Object reference not set to an instance of an object.]
spaw.spaw.samples.demo.Page_Load(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731