private void btn_SaveImage_Click(object sender, EventArgs e) { try { string connectionstring = ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString; Image_SqlCo = new SqlConnection(connectionstring); this.Image_SqlCo.Open(); if (Image_sqlcmd.Parameters.Count == 0) { this.Image_sqlcmd.CommandText = "INSERT INTO tbl_ImageData(IID, Name,Picture) values(@ID,@Name,@Picture)"; this.Image_sqlcmd.Parameters.Add("@ID", System.Data.SqlDbType.Int, 4); this.Image_sqlcmd.Parameters.Add("@Name", System.Data.SqlDbType.VarChar, 50); this.Image_sqlcmd.Parameters.Add("@Picture", System.Data.SqlDbType.Image); } this.Image_sqlcmd.Parameters["@ID"].Value = this.txtId.Text; this.Image_sqlcmd.Parameters["@Name"].Value = this.txtImagePath.Text; this.Image_sqlcmd.Parameters["@Picture"].Value = this.m_barrImg; int iResult = this.Image_sqlcmd.ExecuteNonQuery(); MessageBox.Show(Convert.ToString(iResult)); } catch (Exception ex1) { MessageBox.Show(ex1.ToString()); } finally { this.Image_SqlCo.Close(); } }
<<blockquote class="FQ"><div class="FQA">Quote:</div>?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="Constr" connectionString="Server=.\SQLEXPRESS; Integrated Security=true;Initial Catalog=IMS"/> </connectionStrings> </configuration</blockquote>>
Image_sqlcmd.Connection = Image_SqlC;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)