ใช้งาน Microsoft SQL Server 2008 Authentication กับการ Insert ไม่ได้ครับ
ผมลอง run ระบบไปประมาณ 30 นาที ก็มีข้อความนี้แจ้งมาครับ
Server Error in '/' Application.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
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: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Source Error:
Line 21: " '" + this.txtCountryCode.Text + "','" + this.txtBudget.Text + "','" + this.txtUsed.Text + "')";
Line 22: objConn.ConnectionString = strConnString;
Line 23: objConn.Open();
Line 24: objCmd.Connection = objConn;
Line 25: objCmd.CommandText = strSQL;
Source File: d:\aspxtest\AspNetSQLServerAddInsert.aspx Line: 23
Stack Trace:
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +248
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +245
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +475
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +260
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +2445529
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +2445224
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +354
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +703
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +54
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +2414776
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +92
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1657
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +84
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +1645767
System.Data.SqlClient.SqlConnection.Open() +258
ASP.aspnetsqlserveraddinsert_aspx.btnSave_Click(Object sender, EventArgs e) in d:\aspxtest\AspNetSQLServerAddInsert.aspx:23
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3601
Date :
2010-01-04 02:30:02
By :
nutt
เริ่มเข้านิดๆ แล้ว
คือ มี webserver 2 ยี่ห้อ ให้เครื่องเดียวกันโดยกำหนดไว้คนละ port
พอจะเขียน asp.net ให้ insert ลงฐานข้อมูลแล้วมันไม่ทำงาน
พอรันไปสักพัก database server เดี้ยง แบบนี้ใช่ไหม
Date :
2010-01-04 09:20:46
By :
tungman
database server เดี้ยงนี้คง service มันถึงฆาตอย่างว่าแหละ ให้ restart ดูว่าหายไหม
ส่วน insert ไม่ work ให้ลองใช้คำสั่ง query ง่ายๆ ดูว่าได้ไหม ถ้าได้แสดงว่า insert command ผิด
ไม่ใช่แก็ซโซฮอล์
Date :
2010-01-04 09:24:07
By :
tungman
ลองตรวจสอบดู connection string ดูอีกทีครับ หรือเอามา post ให้ช่วยกันดูก็ดีครับ
** ถ้า SQL Server ที่ใช้ เป็น Express edition ที่หลัง host ต้องใส่เป็น \SQLExpress ด้วยนะครับ
Date :
2010-01-04 12:59:36
By :
salapao_codeman
Load balance : Server 02