|
|
|
สอบถามตัวอย่างการเขียน VB.net C# MySQL เกี่ยวกับการใช้ insert image to database |
|
|
|
|
|
|
|
บทความนี้ครับ
Code (C#)
//*** Insert to Database ***'
SqlConnection objConn = new SqlConnection();
string strConnString = null;
string strSQL = null;
strConnString = "Server=localhost;UID=sa;PASSWORD=;database=mydatabase;Max Pool Size=400;Connect Timeout=600;";
strSQL = "INSERT INTO files (Name,FilesName,FilesType) " + " VALUES " + " (@sName,@sFilesName,@sFilesType)";
objConn.ConnectionString = strConnString;
objConn.Open();
SqlCommand objCmd = new SqlCommand(strSQL, objConn);
objCmd.Parameters.AddWithValue("@sName", this.txtName.Text);
objCmd.Parameters.AddWithValue("@sFilesName", imbByte);
objCmd.Parameters.AddWithValue("@sFilesType", strMIME);
objCmd.ExecuteNonQuery();
objConn.Close();
objConn = null;
(C#) ASP.NET MySQL BLOB Binary Data and Parameterized Query
|
|
|
|
|
Date :
2017-07-14 07:00:53 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|