Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > .NET Framework > Forum > ใช้งาน Microsoft SQL Server 2008 Authentication กับการ Insert ไม่ได้ครับ



 

ใช้งาน Microsoft SQL Server 2008 Authentication กับการ Insert ไม่ได้ครับ

 



Topic : 036464



โพสกระทู้ ( 22 )
บทความ ( 0 )



สถานะออฟไลน์




ผมลองทำตาม (โดยใช้ sql server 2008) แต่การกำหนดค่าเหมือนกับ ตัวอย่างเลย
https://www.thaicreate.com/tutorial/sqlserver-2005-authentication.html


ตอนนี้ผมได้ทำการลง xampp ที่มี apache mysql โดยผมได้ตั้ง localhost ไว้ที่ port 80

และผมได้ลง IIS & asp.net 3.5 ไว้ที่ port 81

โดยผมได้ลอง Run file จาก http://localhost:81/AspNetSQLServerAddInsert.aspx
(ซึ่งผมได้ทำการ copy code มาจาก https://www.thaicreate.com/asp.net/c-sharp-asp.net-sql-server-add-insert-record.html )
ผมได้ทำาการสร้าง DB = mydatabase
และ Table ตาม customer (CustomerID,Name,Email,CountryCode,Budget,Used)

ตอน run
http://localhost:81/AspNetSQLServerAddInsert.aspx ก็ขึ้น blank ทุกช่อง

แต่เมื่อผมลองใส่ค่าทุกช่องตามตัวอย่าง และ กด save แล้ว ปรากฏว่า หน้า
http://localhost:81/AspNetSQLServerAddInsert.aspx ก็ทำการประมวลผล ประมาณซัก 10 กว่านาที

ผมลองไปดูที่ sql server ใน table Customer ก็ไม่มีการ Insert ค่าเข้ามา
ลองทำดู 5-6 รอบ

ผมเลย ปิด หน้านี้เอง และมาตั้งกระทู้ถาม ว่าผมควรไปแก้ไขค่าจากที่ไหน หรือ ไปตรวจดูในส่วนไหน ดีครับ

ขอบคุณครับ


Go to : SQL Server 2008 Authentication Mode



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-01-04 02:24:53 By : nutt View : 3068 Reply : 5
 

 

No. 1



โพสกระทู้ ( 22 )
บทความ ( 0 )



สถานะออฟไลน์


ผมลอง 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
 


 

No. 2



โพสกระทู้ ( 3,144 )
บทความ ( 1 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


ผมไม่เข้าใจที่คุณอธิบายหรอกนะ แต่ข้อความนี้

Quote:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.


ถ้า database server อยู่คนละเครื่องให้ดูว่ามันหลุดออกจาก network หรือเปล่า หรือ service มันตาย (อันนี้ให้ restart server)

ถ้าอยู่ในเครื่องเดียวกันให้ดูว่า service มันตายหรือเปล่า ลอง restart เครื่องดู
Date : 2010-01-04 09:04:16 By : tungman
 

 

No. 3



โพสกระทู้ ( 3,144 )
บทความ ( 1 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


เริ่มเข้านิดๆ แล้ว

คือ มี webserver 2 ยี่ห้อ ให้เครื่องเดียวกันโดยกำหนดไว้คนละ port

พอจะเขียน asp.net ให้ insert ลงฐานข้อมูลแล้วมันไม่ทำงาน

พอรันไปสักพัก database server เดี้ยง แบบนี้ใช่ไหม
Date : 2010-01-04 09:20:46 By : tungman
 


 

No. 4



โพสกระทู้ ( 3,144 )
บทความ ( 1 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


database server เดี้ยงนี้คง service มันถึงฆาตอย่างว่าแหละ ให้ restart ดูว่าหายไหม

ส่วน insert ไม่ work ให้ลองใช้คำสั่ง query ง่ายๆ ดูว่าได้ไหม ถ้าได้แสดงว่า insert command ผิด

ไม่ใช่แก็ซโซฮอล์
Date : 2010-01-04 09:24:07 By : tungman
 


 

No. 5



โพสกระทู้ ( 538 )
บทความ ( 3 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


ลองตรวจสอบดู connection string ดูอีกทีครับ หรือเอามา post ให้ช่วยกันดูก็ดีครับ

** ถ้า SQL Server ที่ใช้ เป็น Express edition ที่หลัง host ต้องใส่เป็น \SQLExpress ด้วยนะครับ
Date : 2010-01-04 12:59:36 By : salapao_codeman
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ใช้งาน Microsoft SQL Server 2008 Authentication กับการ Insert ไม่ได้ครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่