EDN Admin
Well-known member
my code:
private void btnSave_Click(object sender, EventArgs e)<br/>
{<br/>
<br/>
try<br/>
{<br/>
<br/>
string name = @"Cocuments and SettingsicoresoftDesktopmurali.doc";<br/>
<br/>
FileStream fs = new FileStream(name, FileMode.Open, FileAccess.Read);<br/>
BinaryReader br = new BinaryReader(fs);<br/>
<br/>
byte[] bname = new byte[fs.Length];<br/>
fs.Read(bname, 0, Convert.ToInt32(fs.Length));<br/>
<br/>
tbal.my_doc = Convert .ToString (bname);<br/>
string name1 = "insert into test1(mydoc,isactive)values(" + tbal.my_doc + ",true)";<br/>
string i = da.ExecuteCmd(name1);<br/>
//string i = tdal.createfile(tbal);<br/>
if (i == "1")<br/>
{<br/>
MessageBox.Show("saved");<br/>
}<br/>
}<br/>
catch (Exception ex)<br/>
{<br/>
throw ex;<br/>
}<br/>
}
i got error for converting varcahr to varbinary PLEASE ANY ONE HELP
View the full article
private void btnSave_Click(object sender, EventArgs e)<br/>
{<br/>
<br/>
try<br/>
{<br/>
<br/>
string name = @"Cocuments and SettingsicoresoftDesktopmurali.doc";<br/>
<br/>
FileStream fs = new FileStream(name, FileMode.Open, FileAccess.Read);<br/>
BinaryReader br = new BinaryReader(fs);<br/>
<br/>
byte[] bname = new byte[fs.Length];<br/>
fs.Read(bname, 0, Convert.ToInt32(fs.Length));<br/>
<br/>
tbal.my_doc = Convert .ToString (bname);<br/>
string name1 = "insert into test1(mydoc,isactive)values(" + tbal.my_doc + ",true)";<br/>
string i = da.ExecuteCmd(name1);<br/>
//string i = tdal.createfile(tbal);<br/>
if (i == "1")<br/>
{<br/>
MessageBox.Show("saved");<br/>
}<br/>
}<br/>
catch (Exception ex)<br/>
{<br/>
throw ex;<br/>
}<br/>
}
i got error for converting varcahr to varbinary PLEASE ANY ONE HELP
View the full article