Click here to Skip to main content
15,888,610 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: how to append text on textarea T_T no people reply Pin
Jasmine250119-Apr-13 9:45
Jasmine250119-Apr-13 9:45 
AnswerRe: how to append text on textarea T_T no people reply Pin
R. Giskard Reventlov19-Apr-13 10:57
R. Giskard Reventlov19-Apr-13 10:57 
GeneralRe: how to append text on textarea T_T no people reply Pin
Michael†Cheong19-Apr-13 18:39
Michael†Cheong19-Apr-13 18:39 
QuestionCode migration to VB to C# Pin
Leo Rajendra Dhakal18-Apr-13 19:15
Leo Rajendra Dhakal18-Apr-13 19:15 
AnswerRe: Code migration to VB to C# Pin
Karthik Harve18-Apr-13 20:07
professionalKarthik Harve18-Apr-13 20:07 
GeneralRe: Code migration to VB to C# Pin
dusty_dex18-Apr-13 21:48
dusty_dex18-Apr-13 21:48 
AnswerRe: Code migration to VB to C# Pin
Richard Deeming19-Apr-13 2:01
mveRichard Deeming19-Apr-13 2:01 
QuestionHELP T_T save image into database (binary format) Pin
Michael†Cheong18-Apr-13 7:04
Michael†Cheong18-Apr-13 7:04 
HttpPostedFile myPostedFile1 = FileUpload1.PostedFile;
           HttpPostedFile myPostedFile2 = FileUpload2.PostedFile;
           HttpPostedFile myPostedFile3 = FileUpload3.PostedFile;
           HttpPostedFile myPostedFile4 = FileUpload4.PostedFile;
           HttpPostedFile myPostedFile5 = FileUpload5.PostedFile;



           if (myPostedFile1 != null && myPostedFile1.ContentLength > 0)
           {
               FileInfo finfo = new FileInfo(myPostedFile1.FileName);
               string fileExtension = finfo.Extension.ToLower();
               if (fileExtension != ".gif" && fileExtension != ".jpg" && fileExtension != ".jpeg" && fileExtension != ".png")
               {
                   Label3.Text = "error";
                   // MessageBox.SetMessage("WARNING: Please select a picture, with file format gif, jpg, jpeg and png!", Message.MessageType.Warning);
               }

               else if (FileUpload1.HasFile)
               {


                   byte[] productImage = FileUpload1.FileBytes;

                   // SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
                   string connnStr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                   SqlConnection conn1 = new SqlConnection(connnStr);
                   string query = " INSERT INTO Product (ItemImg) VALUES (@img1)";

                   SqlCommand com = new SqlCommand(query, conn1);
                   com.Parameters.Add("@img1", SqlDbType.VarBinary).Value = productImage;

                  // com.Parameters.AddWithValue("@img1", productImage);
                   conn1.Open();
                   com.ExecuteNonQuery();
                   conn1.Close();

                   //getting length of uploaded file



               }

           }


_________________________________________________________________________________________
Cannot insert the value NULL into column 'ItemCode', table 'C:\USERS\MICHAEL\DESKTOP\ASSIGNMENT2\FINAL ASSIGNMENT\FINAL ASSIGNMENT\APP_DATA\DATABASE.MDF.dbo.Product'; column does not allow nulls. INSERT fails.
The statement has been terminated.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'ItemCode', table 'C:\USERS\MICHAEL\DESKTOP\ASSIGNMENT2\FINAL ASSIGNMENT\FINAL ASSIGNMENT\APP_DATA\DATABASE.MDF.dbo.Product'; column does not allow nulls. INSERT fails.
The statement has been terminated.

Source Error:


Line 117:
Line 118: // com.Parameters.AddWithValue("@img1", productImage);
Line 119: conn1.Open();
Line 120: com.ExecuteNonQuery();
Line 121: conn1.Close();



i want to save the image into database viabinary why will occur this problem~ sad
Cry | :(( Cry | :(( Cry | :((
AnswerRe: HELP T_T save image into database (binary format) Pin
Richard Deeming18-Apr-13 7:09
mveRichard Deeming18-Apr-13 7:09 
GeneralRe: HELP T_T save image into database (binary format) Pin
Michael†Cheong18-Apr-13 9:44
Michael†Cheong18-Apr-13 9:44 
GeneralRe: HELP T_T save image into database (binary format) Pin
Richard Deeming18-Apr-13 10:03
mveRichard Deeming18-Apr-13 10:03 
GeneralRe: HELP T_T save image into database (binary format) Pin
Michael†Cheong18-Apr-13 19:52
Michael†Cheong18-Apr-13 19:52 
Questionasp.net handler asking Pin
Michael†Cheong18-Apr-13 4:31
Michael†Cheong18-Apr-13 4:31 
AnswerRe: asp.net handler asking Pin
Richard Deeming18-Apr-13 5:20
mveRichard Deeming18-Apr-13 5:20 
QuestionASP.NET performance Pin
Kalim_mughal18-Apr-13 1:38
Kalim_mughal18-Apr-13 1:38 
AnswerRe: ASP.NET performance Pin
Richard MacCutchan18-Apr-13 1:48
mveRichard MacCutchan18-Apr-13 1:48 
GeneralRe: ASP.NET performance Pin
Kalim_mughal18-Apr-13 2:06
Kalim_mughal18-Apr-13 2:06 
GeneralRe: ASP.NET performance Pin
Richard MacCutchan18-Apr-13 2:10
mveRichard MacCutchan18-Apr-13 2:10 
AnswerRe: ASP.NET performance Pin
ZurdoDev18-Apr-13 2:22
professionalZurdoDev18-Apr-13 2:22 
GeneralRe: ASP.NET performance Pin
Kalim_mughal18-Apr-13 2:45
Kalim_mughal18-Apr-13 2:45 
AnswerRe: ASP.NET performance Pin
ZurdoDev18-Apr-13 2:48
professionalZurdoDev18-Apr-13 2:48 
AnswerRe: ASP.NET performance Pin
Marco Bertschi18-Apr-13 5:51
protectorMarco Bertschi18-Apr-13 5:51 
Questionparallel programming Pin
vasanth2vasu17-Apr-13 10:57
vasanth2vasu17-Apr-13 10:57 
AnswerRe: parallel programming Pin
Rockstar_17-Apr-13 18:25
professionalRockstar_17-Apr-13 18:25 
AnswerRe: parallel programming Pin
Rockstar_17-Apr-13 18:27
professionalRockstar_17-Apr-13 18:27 

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.