nmarun
July 11th, 2003, 07:57 PM
Hi Gurus,
Following is my code:
<!--
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="passengerInfo.aspx.vb" Inherits="project.WebForm1"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<title>Passenger Details</title>
<META content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<META content="Visual Basic 7.0" name="CODE_LANGUAGE">
<META content="JavaScript" name="vs_defaultClientScript">
<META content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<SCRIPT runat="server">
Private Sub bttnRegister_Click(ByVal s As System.Object, ByVal e As System.EventArgs)
Dim sPwd, sFName, sLName As String
Dim zip, points, rows As Integer
Dim cn As SqlConnection = New SqlConnection("data source=MYCOMP\VSdotNET;initial catalog=master;integrated security=SSPI;persist security info=False;workstation id=ENPC3913;packet size=4096")
Dim ds as DataSet
Dim MyCommand As SqlDataAdapter
sPwd = Trim(txtPassword.Text)
sFName = Trim(txtFName.Text)
sLName = Trim(txtLName.Text)
Try
cn.Open()
MyCommand = New SqlDataAdapter("select Count(*) from PassengerInfo", cn)
Dim strSQL As String
strSQL = "Insert into PassengerInfo values(sPwd, sFName, sLName)"
Dim objcommand As New SqlClient.SqlCommand(strSQL, cn)
objcommand.Connection.Open()
objcommand.ExecuteNonQuery()
objcommand.Connection.Close()
objcommand.Dispose()
objcommand = Nothing
Response.Write("Data recorded!")
Catch
Response.Write("Error :" & Err.Number & " " & Err.Description)
End Try
End Sub
</SCRIPT></HEAD>
<BODY text="blue" background="bGround.gif" MS_POSITIONING="GridLayout">
<H2 align="center">Passenger Details</H2>
<FORM id="Form1" method="post" runat="server">
<asp:Label id="lblFName" style="Z-INDEX: 104; LEFT: 170px; POSITION: absolute; TOP: 90px" runat="server" BackColor="White" Height="17px" Width="91px">First Name</asp:Label>
<asp:Label id="lblLName" style="Z-INDEX: 105; LEFT: 170px; POSITION: absolute; TOP: 130px" runat="server" BackColor="White" Height="17px" Width="91px">Last Name</asp:Label>
<asp:Label id="lblPassword" style="Z-INDEX: 106; LEFT: 170px; POSITION: absolute; TOP: 169px" runat="server" BackColor="White" Height="17px" Width="91px">Password</asp:Label>
<asp:Button id="bttnRegister" style="Z-INDEX: 127; LEFT: 347px; POSITION: absolute; TOP: 577px" onclick="bttnRegister_Click" tabIndex="13" runat="server" Height="26px" Width="96px" Text="Register"></asp:Button>
</BODY>
</HTML>
-->
For some unknown reason, it gives an error message:
"Error :5 Login failed for user 'MYCOMP\ASPNET'."
Can any of you gurus, kindly explain the reason of this error message and also let me know how to overcome this?
Tia
Arun
Following is my code:
<!--
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="passengerInfo.aspx.vb" Inherits="project.WebForm1"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<title>Passenger Details</title>
<META content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<META content="Visual Basic 7.0" name="CODE_LANGUAGE">
<META content="JavaScript" name="vs_defaultClientScript">
<META content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<SCRIPT runat="server">
Private Sub bttnRegister_Click(ByVal s As System.Object, ByVal e As System.EventArgs)
Dim sPwd, sFName, sLName As String
Dim zip, points, rows As Integer
Dim cn As SqlConnection = New SqlConnection("data source=MYCOMP\VSdotNET;initial catalog=master;integrated security=SSPI;persist security info=False;workstation id=ENPC3913;packet size=4096")
Dim ds as DataSet
Dim MyCommand As SqlDataAdapter
sPwd = Trim(txtPassword.Text)
sFName = Trim(txtFName.Text)
sLName = Trim(txtLName.Text)
Try
cn.Open()
MyCommand = New SqlDataAdapter("select Count(*) from PassengerInfo", cn)
Dim strSQL As String
strSQL = "Insert into PassengerInfo values(sPwd, sFName, sLName)"
Dim objcommand As New SqlClient.SqlCommand(strSQL, cn)
objcommand.Connection.Open()
objcommand.ExecuteNonQuery()
objcommand.Connection.Close()
objcommand.Dispose()
objcommand = Nothing
Response.Write("Data recorded!")
Catch
Response.Write("Error :" & Err.Number & " " & Err.Description)
End Try
End Sub
</SCRIPT></HEAD>
<BODY text="blue" background="bGround.gif" MS_POSITIONING="GridLayout">
<H2 align="center">Passenger Details</H2>
<FORM id="Form1" method="post" runat="server">
<asp:Label id="lblFName" style="Z-INDEX: 104; LEFT: 170px; POSITION: absolute; TOP: 90px" runat="server" BackColor="White" Height="17px" Width="91px">First Name</asp:Label>
<asp:Label id="lblLName" style="Z-INDEX: 105; LEFT: 170px; POSITION: absolute; TOP: 130px" runat="server" BackColor="White" Height="17px" Width="91px">Last Name</asp:Label>
<asp:Label id="lblPassword" style="Z-INDEX: 106; LEFT: 170px; POSITION: absolute; TOP: 169px" runat="server" BackColor="White" Height="17px" Width="91px">Password</asp:Label>
<asp:Button id="bttnRegister" style="Z-INDEX: 127; LEFT: 347px; POSITION: absolute; TOP: 577px" onclick="bttnRegister_Click" tabIndex="13" runat="server" Height="26px" Width="96px" Text="Register"></asp:Button>
</BODY>
</HTML>
-->
For some unknown reason, it gives an error message:
"Error :5 Login failed for user 'MYCOMP\ASPNET'."
Can any of you gurus, kindly explain the reason of this error message and also let me know how to overcome this?
Tia
Arun