|
 |
|
สอบถามการกดส่งข้อมูลครั้งเดียวให้เข้าไปหลายๆ database หน่อยครับ |
|
 |
|
|
 |
 |
|
ก็มองทีละ base ซิครับ
1 base ต่อ 1 connection ต่อ 1 ครั้ง
หรือจะเขียนเป็น ฟังค์ชันโดยอ้างอิงจาก connectionstring
Code (C#)
private static void CreateCommand(string queryString,
string connectionString)
{
using (SqlConnection connection = new SqlConnection(
connectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
command.Connection.Open();
command.ExecuteNonQuery();
}
}
https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executenonquery(v=vs.110).aspx
แบบนี้น่าจะใช้ sql กับ base ไหน กี่ base ก็ได้
Code (C#)
CreateCommand(strInsert1,strconn1);
CreateCommand(strInsert2,strconn2);
CreateCommand(strInsert3,strconn3);
CreateCommand(strInsert4,strconn4);
CreateCommand(strInsert5,strconn5);
CreateCommand(strInsert6,strconn6);
//insert 6 base
|
 |
 |
 |
 |
Date :
2017-07-20 12:20:13 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|