Click here to Skip to main content
15,908,172 members
Home / Discussions / C#
   

C#

 
GeneralWeb Folder Problem Pin
arslanjatt7-Dec-07 20:38
arslanjatt7-Dec-07 20:38 
GeneralRe: Web Folder Problem Pin
pmarfleet7-Dec-07 23:30
pmarfleet7-Dec-07 23:30 
GeneralRe: Web Folder Problem Pin
Christian Graus7-Dec-07 23:34
protectorChristian Graus7-Dec-07 23:34 
Generalsome question about VS2008 Pin
E_Gold7-Dec-07 20:13
E_Gold7-Dec-07 20:13 
GeneralRe: some question about VS2008 Pin
ekynox7-Dec-07 20:23
ekynox7-Dec-07 20:23 
GeneralRe: some question about VS2008 Pin
DaveyM6910-Dec-07 14:09
professionalDaveyM6910-Dec-07 14:09 
Questionhow to bind picture and database ? Pin
E_Gold7-Dec-07 19:58
E_Gold7-Dec-07 19:58 
AnswerRe: how to bind picture and database ? Pin
I Believe In GOD7-Dec-07 21:56
I Believe In GOD7-Dec-07 21:56 
hi ,
here is the code for sql database

---- I have a table (myTable) with columns (ID (int32) , photo (image))
---- ID Field is auto incearsment

SqlParameter SqlPR;
SqlCommand SqlCmd = new SqlCommand();
SqlCmd.Connection = ValidConnection;
SqlCmd.CommandText = "INSERT INTO myTable (Photo)VALUES ( @photo)"
byte [] ImageByte = ReadImage2ByteArray (PhotoPath);
SqlPR = SqlCmd.Parameters.Add ("@Photo",SqlDbType.Binary,ImageByte.Length ,"Photo");
SqlPR.Value = ImageByte;
SqlCmd.ExecuteNonQuery();

--------- Convert Image to byte array
public static byte[] ReadImage2ByteArray(string fileName)
{
using(Bitmap image = new Bitmap(fileName))
{
MemoryStream stream = new MemoryStream();
Image.Save(stream,System.Drawing.Imaging.ImageFormat.Bmp);
return stream.ToArray();
}
}

-------- if you want to retrive image from db then here is a hint
SqlDataReader DataRD;
SqlCmd.CommandText = "SELECT * FROM myTabe";
DataRD = SqlCmd.ExecuteReader () ;
byte[] content = (byte[])DataRD["Photo"];
MemoryStream stream = new MemoryStream(content);
Bitmap image = new Bitmap(stream);
picture1.Image = image;


------------ P.s
this code didn't proccess Sql Connections strings
you have to write your own connection strings ( I GUESS you know how to do it )

Kind regards
Generalno splitcontainer in wpf Pin
angels7777-Dec-07 19:53
angels7777-Dec-07 19:53 
GeneralRe: no splitcontainer in wpf Pin
Christian Graus7-Dec-07 23:43
protectorChristian Graus7-Dec-07 23:43 
GeneralRe: no splitcontainer in wpf Pin
angels7778-Dec-07 23:36
angels7778-Dec-07 23:36 
GeneralWindows form in Windows service Pin
Arun Abraham Jose7-Dec-07 19:10
Arun Abraham Jose7-Dec-07 19:10 
GeneralCrytsal report Pin
new2pgrmg7-Dec-07 18:18
new2pgrmg7-Dec-07 18:18 
GeneralSetting up DataTable with rows Pin
MAW307-Dec-07 16:36
MAW307-Dec-07 16:36 
GeneralRe: Setting up DataTable with rows Pin
Chetan Patel7-Dec-07 17:08
Chetan Patel7-Dec-07 17:08 
GeneralRe: Setting up DataTable with rows Pin
MAW307-Dec-07 17:22
MAW307-Dec-07 17:22 
QuestionCalling Windows form in Windows services Pin
Arun Abraham Jose7-Dec-07 16:04
Arun Abraham Jose7-Dec-07 16:04 
GeneralRe: Calling Windows form in Windows services Pin
Arun Abraham Jose7-Dec-07 18:48
Arun Abraham Jose7-Dec-07 18:48 
GeneralSpace Pin
Dromar7-Dec-07 15:33
Dromar7-Dec-07 15:33 
GeneralRe: Space Pin
Anthony Mushrow7-Dec-07 15:38
professionalAnthony Mushrow7-Dec-07 15:38 
GeneralRe: Space Pin
Dromar7-Dec-07 16:01
Dromar7-Dec-07 16:01 
GeneralStrange behaviour of WebBrowser Control?!!! Pin
Khoramdin7-Dec-07 14:43
Khoramdin7-Dec-07 14:43 
GeneralRe: Strange behaviour of WebBrowser Control?!!! Pin
Anthony Mushrow7-Dec-07 14:52
professionalAnthony Mushrow7-Dec-07 14:52 
GeneralRe: Strange behaviour of WebBrowser Control?!!! Pin
Khoramdin8-Dec-07 4:59
Khoramdin8-Dec-07 4:59 
GeneralRe: Strange behaviour of WebBrowser Control?!!! Pin
Anthony Mushrow8-Dec-07 5:17
professionalAnthony Mushrow8-Dec-07 5:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.