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

ASP.NET

 
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 
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 
protected void Save_Click1(object sender, EventArgs e)
       {
           //Response.Redirect("~/2Staff/EditProduct.aspx?txtID=" + txtID.Text);

           string connStr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
           SqlConnection conn = new SqlConnection(connStr);
           string strInsert;
           SqlCommand cmdins;

           // if (txtbox3.Trim().Length == 0)

           if (DropDownList1.SelectedValue.Equals("Default"))   //Discount
           {
               String txtbox3 = TextBox3.Text;
               double t = Convert.ToDouble(txtbox3);
               Dis = Math.Round(t, 2);
               Label5.Text = Dis.ToString();
           }

           conn.Open();
           strInsert = "INSERT INTO Product (ItemCode,ItemName,ItemCategory,ItemDesc,ItemPrice) VALUES(@code,@name,@ctgy,@desc,@price)";
           cmdins = new SqlCommand(strInsert, conn);

           cmdins.Parameters.AddWithValue("@code", txtID.Text);
           cmdins.Parameters.AddWithValue("@name", TextBox2.Text);
           cmdins.Parameters.AddWithValue("@ctgy", RadioButtonList1.SelectedValue.ToString());
           cmdins.Parameters.AddWithValue("@desc", Editor1.Content);
           cmdins.Parameters.AddWithValue("@price", Dis);
           cmdins.ExecuteNonQuery();

           conn.Close();

           //-----------------------------------------------------------------------------image--------------------------------------
           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



               }

           }

           //--------------------------------------------Auto Generate ID---------------------------------------------------

           string strSelect;
           SqlCommand cmd;
           SqlDataReader myReader;

           conn.Open();
           strSelect = "Select ItemCode From Product";
           cmd = new SqlCommand(strSelect, conn);
           myReader = cmd.ExecuteReader();

           while (myReader.Read())
           {
               String Strings = myReader["ItemCode"].ToString();

               String intString = Strings.Substring(3, 5);
               txtID.Text = "" + intString;
               columnValue = int.Parse(intString);
               newValue = columnValue + 1;
               txtID.Text = "PIC" + newValue.ToString();

           }

           myReader.Close();
           conn.Close();

           //--------------------------------------------Close Auto Generate ID---------------------------------------------------

       }


yaya thx u answer~Thumbs Up | :thumbsup: by clicking one button i nid to do alot function @@ that make me no idea~ but thx u let me know what the problem D'Oh! | :doh: hehe if u free help me see the code and let me know nid how to do Rose | [Rose]
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 
AnswerRe: parallel programming Pin
Richard MacCutchan17-Apr-13 22:41
mveRichard MacCutchan17-Apr-13 22:41 
GeneralRe: parallel programming Pin
vasanth2vasu18-Apr-13 1:24
vasanth2vasu18-Apr-13 1:24 

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.