Server Error in '/data' Application.
------------------------
SQL Server does not exist or access denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.
Source Error:
Line 87: MyCommand = New SqlCommand(InsertCmd, MyConnection)
Line 88:
Line 89: MyCommand.Connection.Open()
Line 90:
Line 91: Try
Source File: c:\inetpub\wwwroot\data\Registration1.aspx.vb Line: 89
Stack Trace:
[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction)
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open() +384
data.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\data\Registration1.aspx.vb:89
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277
------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
what is wrong with the code? my code is this...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MyConnection = New SqlConnection("server=(local)\NetSDK;database=shangri;Integrated Security=SSPI")
Dim DS As DataSet
Dim MyCommand As SqlCommand
Dim InsertCmd As String = "INSERT INTO Customer(custID,custFirstname) VALUES('" & txtLastName.Text & "', '" & txtFirstName.Text & "')"
MyCommand = New SqlCommand(InsertCmd, MyConnection)
MyCommand.Connection.Open()
Try
MyCommand.ExecuteNonQuery()
Catch ex As Exception
Response.Write("error hao zhi")
End Try
MyCommand.Connection.Close()
End Sub
------------------
i have also included import system.data.sqlclient
Please help!
what the problem? Thansk bye!!! :)=(local)\NetSDK?
i think your connection string's whack|||INSERT INTO Customer(custID,custFirstname) VALUES('" & txtLastName.Text & "', '" & txtFirstName.Text & "')"
That's also going to generate an error. Unless custID is the users last name.|||any suggestion on that connection string?
No comments:
Post a Comment