question

Booney-3048 avatar image
0 Votes"
Booney-3048 asked karenpayneoregon edited

SqLite save to DataBase

I am trying to save 5 textboxs 1 combo and datetimepicker to a database but the only thing saved is the datetimepicker. I am very confused with this and dont see why this code isn't working any suggestions much appreciated.


 private void btn_Save_Click(object sender, EventArgs e)
         {     
                
                 if (lbl_LibId.Text == "*")
             {
                 string sql = "insert into Request (Date, Part_Number, Request_By, Assigned_CC, IC_Analyst, Priority, Comments)" +
    
                              " values(@Date, @Part_Number, @Request_By, @Assigned_CC, @IC_Analyst, @Priority, @Comments)";
    
                 Request.ExecuteSQL(sql, new[] {
    
                         new SQLiteParameter("@Date", dateTimePicker1.Text),
                         new SQLiteParameter("@Part_Number", txt_Part_Number.Text),
                         new SQLiteParameter("@Request_By", txt_Count_Request_By.Text),
                         new SQLiteParameter("@Assigned_CC", txt_Assigned_Code.Text),
                         new SQLiteParameter("@IC_Analyst", txt_Analyst.Text),
                         new SQLiteParameter("@Priority", cb_Priority.Text),                       
                         new SQLiteParameter("@Comments", txt_Comments.Text),                         
                            
                     });
                    
    
                 DataBind();
                    
             }
         }
dotnet-csharpwindows-formsdotnet-sqlite
· 11
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Are all columns in your Request table string-based?

0 Votes 0 ·

They are all Text.

138963-screenshot-2021-10-08-111018.png


0 Votes 0 ·

Do the other columns end up as NULL in the DB, or an empty string? Have you debugged that call to make sure the .Text properties are populated with what you expect?

0 Votes 0 ·
Show more comments

What value is being returned from ExecuteNonQuery ?

0 Votes 0 ·

this is whats is returned

139024-screenshot-2021-10-08-125222.png


0 Votes 0 ·

In the screenshot, which is the ExecuteNonQuery?

0 Votes 0 ·
Show more comments

0 Answers