Click here to Skip to main content
15,891,248 members
Home / Discussions / C#
   

C#

 
AnswerRe: sharing files on single pc in .net Pin
User 418025417-Jul-15 9:54
User 418025417-Jul-15 9:54 
Questioncode for androide xml analyser Pin
Member 115824057-Apr-15 22:29
Member 115824057-Apr-15 22:29 
QuestionRe: code for androide xml analyser Pin
Stefto7-Apr-15 22:56
professionalStefto7-Apr-15 22:56 
AnswerRe: code for androide xml analyser Pin
Simon_Whale7-Apr-15 23:19
Simon_Whale7-Apr-15 23:19 
QuestionAudio Visualisation For RGB STRIP Via C# Pin
Marek Gamelaster Kraus7-Apr-15 9:00
Marek Gamelaster Kraus7-Apr-15 9:00 
AnswerRe: Audio Visualisation For RGB STRIP Via C# Pin
V.7-Apr-15 20:03
professionalV.7-Apr-15 20:03 
GeneralRe: Audio Visualisation For RGB STRIP Via C# Pin
Marek Gamelaster Kraus8-Apr-15 3:11
Marek Gamelaster Kraus8-Apr-15 3:11 
QuestionEmpty path name is not legal - image upload Pin
DPaul19947-Apr-15 6:49
DPaul19947-Apr-15 6:49 
I have a form with a few textboxes and checkboxes. I want to store in database values from them. But, I also have a button that selects an image from computer and show link of the image in a textbox. Well, I want to insert data but without inserting an image and here comes my problem, I receive: Empty path name is not legal. Can anybody help me? Thanks Smile | :)
Code is here:
C#
try
               {
                   byte[] imageBt = null;
                   FileStream fstream = new FileStream(this.textBox5.Text, FileMode.Open, FileAccess.Read);
                   BinaryReader br = new BinaryReader(fstream);
                   imageBt = br.ReadBytes((int)fstream.Length);
                   SQLiteCommand com = new SQLiteCommand("insert into questions(question,answer1,answer2,answer3,option1,option2,option3,category,qcategory,indexrow,indexyes,indexno,cherowstart,cheyes,cheno,currentrow,image) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + result1 + "','" + result2 + "','" + result3 + "','" + comboBox1.SelectedItem + "','" + comboBox2.SelectedItem + "',0,0,0,0,0,0,0,@IMG)", Conexiune.getConnection());
                   com.Parameters.Add(new SQLiteParameter("@IMG", imageBt));
                   com.ExecuteNonQuery();
               }
               catch (Exception ex)
               {
                   MessageBox.Show(ex.Message);
               }

Code for image selection:
C#
try
            {
                OpenFileDialog dlg = new OpenFileDialog();
                dlg.Filter = "JPG Files(.jpg)|.jpg|PNG Files(.png)|.png|All Files(.)|.";
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    string picLoc = dlg.FileName.ToString();
                    textBox5.Text = picLoc;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

AnswerRe: Empty path name is not legal - image upload Pin
Eddy Vluggen7-Apr-15 8:03
professionalEddy Vluggen7-Apr-15 8:03 
AnswerRe: Empty path name is not legal - image upload Pin
OriginalGriff7-Apr-15 8:05
mveOriginalGriff7-Apr-15 8:05 
GeneralRe: Empty path name is not legal - image upload Pin
DPaul19947-Apr-15 8:49
DPaul19947-Apr-15 8:49 
GeneralRe: Empty path name is not legal - image upload Pin
OriginalGriff8-Apr-15 0:18
mveOriginalGriff8-Apr-15 0:18 
GeneralRe: Empty path name is not legal - image upload Pin
DPaul19949-Apr-15 4:09
DPaul19949-Apr-15 4:09 
QuestionSend SMS by using GSM dongle Pin
Member 115873477-Apr-15 5:35
Member 115873477-Apr-15 5:35 
AnswerRe: Send SMS by using GSM dongle Pin
Richard MacCutchan7-Apr-15 5:36
mveRichard MacCutchan7-Apr-15 5:36 
AnswerRe: Send SMS by using GSM dongle Pin
Raj Mouli7-Apr-15 20:47
Raj Mouli7-Apr-15 20:47 
QuestionQuery and modify remote host (Linux\Unix) Pin
elza637-Apr-15 5:08
elza637-Apr-15 5:08 
AnswerRe: Query and modify remote host (Linux\Unix) Pin
Richard MacCutchan7-Apr-15 5:35
mveRichard MacCutchan7-Apr-15 5:35 
AnswerRe: Query and modify remote host (Linux\Unix) Pin
Eddy Vluggen7-Apr-15 5:39
professionalEddy Vluggen7-Apr-15 5:39 
GeneralRe: Query and modify remote host (Linux\Unix) Pin
elza6310-Apr-15 3:35
elza6310-Apr-15 3:35 
GeneralRe: Query and modify remote host (Linux\Unix) Pin
Eddy Vluggen10-Apr-15 8:06
professionalEddy Vluggen10-Apr-15 8:06 
QuestionEntity framework in C# MVC Pin
Dolly Nimavat7-Apr-15 0:42
Dolly Nimavat7-Apr-15 0:42 
AnswerRe: Entity framework in C# MVC Pin
Sascha Lefèvre7-Apr-15 1:00
professionalSascha Lefèvre7-Apr-15 1:00 
GeneralRe: Entity framework in C# MVC Pin
Pete O'Hanlon7-Apr-15 1:36
mvePete O'Hanlon7-Apr-15 1:36 
GeneralRe: Entity framework in C# MVC Pin
Sascha Lefèvre7-Apr-15 1:47
professionalSascha Lefèvre7-Apr-15 1:47 

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.