WrapperImpersonationContext context = new WrapperImpersonationContext(System.Environment.MachineName, "guest", ""); context.Enter(); SqlConnection sqlConnection2 = new SqlConnection("Data Source=" + DBConn.ConnectionProperties.ServerName + ";Database=JMSIMG;User ID=" + DBConn.ConnectionProperties.DBUsername + ";Password=" + DBConn.ConnectionProperties.DBPassword + ";Trusted_Connection=False;Integrated Security = true"); SqlCommand sqlCommand2 = sqlConnection2.CreateCommand(); sqlCommand2.CommandText = "Select GET_FILESTREAM_TRANSACTION_CONTEXT() As TransactionContext"; sqlConnection2.Open(); SqlCommand("Select GET_FILESTREAM_TRANSACTION_CONTEXT() As TransactionContext")).Tables[0].Rows[0][0]; byte[] transactionContext1 = (byte[])sqlCommand2.ExecuteScalar();
SqlFileStream sqlFileStream1 = new SqlFileStream(filePath1, transactionContext1, FileAccess.Write)
byte[] ProductImage = grbPictureBox1.BinaryValue; sqlFileStream1.Write(ProductImage, 0, ProductImage.Length); sqlFileStream1.Close(); transactionScope.Complete(); context.Leave();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)