Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. how can u insert values in the database

how can u insert values in the database

Scheduled Pinned Locked Moved ASP.NET
csharphelpasp-netdatabasesysadmin
13 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sumanmks
    wrote on last edited by
    #1

    hi i am very new to asp.net. It may be the simplest problem to u. but for me it is a bit difficult. I have written a code for inserting the values in the SQLEXPRESS in C#.but not able to insert it. Can Any one help me out. the code is as follows: protected void Button1_Click1(object sender, EventArgs e) { SqlConnection myConnection = new SqlConnection(); myConnection.ConnectionString = @"Data Source=localhost\SQLEXPRESS;" + "Initial Catalog=testdata;Integrated Security=SSPI"; try { myConnection.Open(); Label1.Text = "<b>Server Version:</b> " + myConnection.ServerVersion; Label1.Text += "<br /><b>Connection Is:</b> " + myConnection.State.ToString(); string insertSQL; insertSQL = "INSERT INTO jobseekerinfo ("; insertSQL += "firstname, middlename, lastname, "; insertSQL += "dob, address, city, state, zip, mobile, phone, engcollege, "; insertSQL += "enguniversity, engaggergate, pucollege, puuniversity, pumarks,"; insertSQL += "school, scuniversity, scmarks, totalyears, totalmonths,"; insertSQL += "workplace, job, skills"; insertSQL += "VALUES ('"; insertSQL += TextBox1.Text + "', '"; insertSQL += TextBox2.Text + "', '"; insertSQL += TextBox3.Text + "', '"; insertSQL += TextBox29.Text + "', '"; insertSQL += TextBox5.Text + "', '"; insertSQL += TextBox11.Text + "', '"; insertSQL += TextBox12.Text + "', '"; insertSQL += TextBox14.Text + "', '"; insertSQL += TextBox6.Text + "', '"; insertSQL += TextBox15.Text + "', '"; insertSQL += TextBox4.Text + "', '"; insertSQL += TextBox8.Text + "', '"; insertSQL += TextBox9.Text + "', '"; insertSQL += TextBox10.Text + "', '"; insertSQL += TextBox30.Text + "', '"; insertSQL += TextBox31.Text + "', '"; insertSQL += TextBox32.Text + "', '"; insertSQL += TextBox33.Text + "', '"; insertSQL += TextBox34.Text + "', '"; insertSQL += TextBox35.Text + "', '"; insertSQL += TextBox36.Text + "', '"; insertSQL += TextBox18.Text + "', '"; insertSQL += TextBox19.Text + "', '"; insertSQL += TextBox20.Text + "', '"; insertSQL += "')"; SqlCommand cmd = new SqlCommand(insertSQL, myConnection); int added = 0; added = cmd.ExecuteNonQuery(); Label1.Text = added.ToString() + " records inserted."; } finally { myConnection.Close(); Label1.Text += "<br /><b>Connection Is:</b> " + myConnection.State.ToString(); } } Thanks in advance

    A J A G V 6 Replies Last reply
    0
    • S sumanmks

      hi i am very new to asp.net. It may be the simplest problem to u. but for me it is a bit difficult. I have written a code for inserting the values in the SQLEXPRESS in C#.but not able to insert it. Can Any one help me out. the code is as follows: protected void Button1_Click1(object sender, EventArgs e) { SqlConnection myConnection = new SqlConnection(); myConnection.ConnectionString = @"Data Source=localhost\SQLEXPRESS;" + "Initial Catalog=testdata;Integrated Security=SSPI"; try { myConnection.Open(); Label1.Text = "<b>Server Version:</b> " + myConnection.ServerVersion; Label1.Text += "<br /><b>Connection Is:</b> " + myConnection.State.ToString(); string insertSQL; insertSQL = "INSERT INTO jobseekerinfo ("; insertSQL += "firstname, middlename, lastname, "; insertSQL += "dob, address, city, state, zip, mobile, phone, engcollege, "; insertSQL += "enguniversity, engaggergate, pucollege, puuniversity, pumarks,"; insertSQL += "school, scuniversity, scmarks, totalyears, totalmonths,"; insertSQL += "workplace, job, skills"; insertSQL += "VALUES ('"; insertSQL += TextBox1.Text + "', '"; insertSQL += TextBox2.Text + "', '"; insertSQL += TextBox3.Text + "', '"; insertSQL += TextBox29.Text + "', '"; insertSQL += TextBox5.Text + "', '"; insertSQL += TextBox11.Text + "', '"; insertSQL += TextBox12.Text + "', '"; insertSQL += TextBox14.Text + "', '"; insertSQL += TextBox6.Text + "', '"; insertSQL += TextBox15.Text + "', '"; insertSQL += TextBox4.Text + "', '"; insertSQL += TextBox8.Text + "', '"; insertSQL += TextBox9.Text + "', '"; insertSQL += TextBox10.Text + "', '"; insertSQL += TextBox30.Text + "', '"; insertSQL += TextBox31.Text + "', '"; insertSQL += TextBox32.Text + "', '"; insertSQL += TextBox33.Text + "', '"; insertSQL += TextBox34.Text + "', '"; insertSQL += TextBox35.Text + "', '"; insertSQL += TextBox36.Text + "', '"; insertSQL += TextBox18.Text + "', '"; insertSQL += TextBox19.Text + "', '"; insertSQL += TextBox20.Text + "', '"; insertSQL += "')"; SqlCommand cmd = new SqlCommand(insertSQL, myConnection); int added = 0; added = cmd.ExecuteNonQuery(); Label1.Text = added.ToString() + " records inserted."; } finally { myConnection.Close(); Label1.Text += "<br /><b>Connection Is:</b> " + myConnection.State.ToString(); } } Thanks in advance

      J Offline
      J Offline
      J4amieC
      wrote on last edited by
      #2

      sumanmks wrote:

      but not able to insert it

      We're not mindreaders you know. What error do you get?

      A S 2 Replies Last reply
      0
      • S sumanmks

        hi i am very new to asp.net. It may be the simplest problem to u. but for me it is a bit difficult. I have written a code for inserting the values in the SQLEXPRESS in C#.but not able to insert it. Can Any one help me out. the code is as follows: protected void Button1_Click1(object sender, EventArgs e) { SqlConnection myConnection = new SqlConnection(); myConnection.ConnectionString = @"Data Source=localhost\SQLEXPRESS;" + "Initial Catalog=testdata;Integrated Security=SSPI"; try { myConnection.Open(); Label1.Text = "<b>Server Version:</b> " + myConnection.ServerVersion; Label1.Text += "<br /><b>Connection Is:</b> " + myConnection.State.ToString(); string insertSQL; insertSQL = "INSERT INTO jobseekerinfo ("; insertSQL += "firstname, middlename, lastname, "; insertSQL += "dob, address, city, state, zip, mobile, phone, engcollege, "; insertSQL += "enguniversity, engaggergate, pucollege, puuniversity, pumarks,"; insertSQL += "school, scuniversity, scmarks, totalyears, totalmonths,"; insertSQL += "workplace, job, skills"; insertSQL += "VALUES ('"; insertSQL += TextBox1.Text + "', '"; insertSQL += TextBox2.Text + "', '"; insertSQL += TextBox3.Text + "', '"; insertSQL += TextBox29.Text + "', '"; insertSQL += TextBox5.Text + "', '"; insertSQL += TextBox11.Text + "', '"; insertSQL += TextBox12.Text + "', '"; insertSQL += TextBox14.Text + "', '"; insertSQL += TextBox6.Text + "', '"; insertSQL += TextBox15.Text + "', '"; insertSQL += TextBox4.Text + "', '"; insertSQL += TextBox8.Text + "', '"; insertSQL += TextBox9.Text + "', '"; insertSQL += TextBox10.Text + "', '"; insertSQL += TextBox30.Text + "', '"; insertSQL += TextBox31.Text + "', '"; insertSQL += TextBox32.Text + "', '"; insertSQL += TextBox33.Text + "', '"; insertSQL += TextBox34.Text + "', '"; insertSQL += TextBox35.Text + "', '"; insertSQL += TextBox36.Text + "', '"; insertSQL += TextBox18.Text + "', '"; insertSQL += TextBox19.Text + "', '"; insertSQL += TextBox20.Text + "', '"; insertSQL += "')"; SqlCommand cmd = new SqlCommand(insertSQL, myConnection); int added = 0; added = cmd.ExecuteNonQuery(); Label1.Text = added.ToString() + " records inserted."; } finally { myConnection.Close(); Label1.Text += "<br /><b>Connection Is:</b> " + myConnection.State.ToString(); } } Thanks in advance

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #3

        AS you are very new with this and your code is also saying like that. I would suggest you to read this article first, Using ADO.NET for beginners[^]

        Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Visit My Latest Article : Beginner's Guide : Exploring IIS 6.0 With ASP.NET

        1 Reply Last reply
        0
        • J J4amieC

          sumanmks wrote:

          but not able to insert it

          We're not mindreaders you know. What error do you get?

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          It was a cross post and both we have missed it !!

          Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Visit My Latest Article : Beginner's Guide : Exploring IIS 6.0 With ASP.NET

          1 Reply Last reply
          0
          • S sumanmks

            hi i am very new to asp.net. It may be the simplest problem to u. but for me it is a bit difficult. I have written a code for inserting the values in the SQLEXPRESS in C#.but not able to insert it. Can Any one help me out. the code is as follows: protected void Button1_Click1(object sender, EventArgs e) { SqlConnection myConnection = new SqlConnection(); myConnection.ConnectionString = @"Data Source=localhost\SQLEXPRESS;" + "Initial Catalog=testdata;Integrated Security=SSPI"; try { myConnection.Open(); Label1.Text = "<b>Server Version:</b> " + myConnection.ServerVersion; Label1.Text += "<br /><b>Connection Is:</b> " + myConnection.State.ToString(); string insertSQL; insertSQL = "INSERT INTO jobseekerinfo ("; insertSQL += "firstname, middlename, lastname, "; insertSQL += "dob, address, city, state, zip, mobile, phone, engcollege, "; insertSQL += "enguniversity, engaggergate, pucollege, puuniversity, pumarks,"; insertSQL += "school, scuniversity, scmarks, totalyears, totalmonths,"; insertSQL += "workplace, job, skills"; insertSQL += "VALUES ('"; insertSQL += TextBox1.Text + "', '"; insertSQL += TextBox2.Text + "', '"; insertSQL += TextBox3.Text + "', '"; insertSQL += TextBox29.Text + "', '"; insertSQL += TextBox5.Text + "', '"; insertSQL += TextBox11.Text + "', '"; insertSQL += TextBox12.Text + "', '"; insertSQL += TextBox14.Text + "', '"; insertSQL += TextBox6.Text + "', '"; insertSQL += TextBox15.Text + "', '"; insertSQL += TextBox4.Text + "', '"; insertSQL += TextBox8.Text + "', '"; insertSQL += TextBox9.Text + "', '"; insertSQL += TextBox10.Text + "', '"; insertSQL += TextBox30.Text + "', '"; insertSQL += TextBox31.Text + "', '"; insertSQL += TextBox32.Text + "', '"; insertSQL += TextBox33.Text + "', '"; insertSQL += TextBox34.Text + "', '"; insertSQL += TextBox35.Text + "', '"; insertSQL += TextBox36.Text + "', '"; insertSQL += TextBox18.Text + "', '"; insertSQL += TextBox19.Text + "', '"; insertSQL += TextBox20.Text + "', '"; insertSQL += "')"; SqlCommand cmd = new SqlCommand(insertSQL, myConnection); int added = 0; added = cmd.ExecuteNonQuery(); Label1.Text = added.ToString() + " records inserted."; } finally { myConnection.Close(); Label1.Text += "<br /><b>Connection Is:</b> " + myConnection.State.ToString(); } } Thanks in advance

            A Offline
            A Offline
            Abhishek Sur
            wrote on last edited by
            #5

            sumanmks wrote:

            insertSQL += "workplace, job, skills";

            where is the end bracket of fields ??? :doh: It should be "workplace, job, skills)";

            Abhishek Sur


            My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

            **Don't forget to click "Good Answer" if you like to.

            S 1 Reply Last reply
            0
            • J J4amieC

              sumanmks wrote:

              but not able to insert it

              We're not mindreaders you know. What error do you get?

              S Offline
              S Offline
              sumanmks
              wrote on last edited by
              #6

              hello sir, there is no syntax errors

              1 Reply Last reply
              0
              • A Abhishek Sur

                sumanmks wrote:

                insertSQL += "workplace, job, skills";

                where is the end bracket of fields ??? :doh: It should be "workplace, job, skills)";

                Abhishek Sur


                My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

                **Don't forget to click "Good Answer" if you like to.

                S Offline
                S Offline
                sumanmks
                wrote on last edited by
                #7

                hi sir, Can i know y there will be a pop up message when i run the project saying that Visual Studio just in-time debugger

                A 1 Reply Last reply
                0
                • S sumanmks

                  hi i am very new to asp.net. It may be the simplest problem to u. but for me it is a bit difficult. I have written a code for inserting the values in the SQLEXPRESS in C#.but not able to insert it. Can Any one help me out. the code is as follows: protected void Button1_Click1(object sender, EventArgs e) { SqlConnection myConnection = new SqlConnection(); myConnection.ConnectionString = @"Data Source=localhost\SQLEXPRESS;" + "Initial Catalog=testdata;Integrated Security=SSPI"; try { myConnection.Open(); Label1.Text = "<b>Server Version:</b> " + myConnection.ServerVersion; Label1.Text += "<br /><b>Connection Is:</b> " + myConnection.State.ToString(); string insertSQL; insertSQL = "INSERT INTO jobseekerinfo ("; insertSQL += "firstname, middlename, lastname, "; insertSQL += "dob, address, city, state, zip, mobile, phone, engcollege, "; insertSQL += "enguniversity, engaggergate, pucollege, puuniversity, pumarks,"; insertSQL += "school, scuniversity, scmarks, totalyears, totalmonths,"; insertSQL += "workplace, job, skills"; insertSQL += "VALUES ('"; insertSQL += TextBox1.Text + "', '"; insertSQL += TextBox2.Text + "', '"; insertSQL += TextBox3.Text + "', '"; insertSQL += TextBox29.Text + "', '"; insertSQL += TextBox5.Text + "', '"; insertSQL += TextBox11.Text + "', '"; insertSQL += TextBox12.Text + "', '"; insertSQL += TextBox14.Text + "', '"; insertSQL += TextBox6.Text + "', '"; insertSQL += TextBox15.Text + "', '"; insertSQL += TextBox4.Text + "', '"; insertSQL += TextBox8.Text + "', '"; insertSQL += TextBox9.Text + "', '"; insertSQL += TextBox10.Text + "', '"; insertSQL += TextBox30.Text + "', '"; insertSQL += TextBox31.Text + "', '"; insertSQL += TextBox32.Text + "', '"; insertSQL += TextBox33.Text + "', '"; insertSQL += TextBox34.Text + "', '"; insertSQL += TextBox35.Text + "', '"; insertSQL += TextBox36.Text + "', '"; insertSQL += TextBox18.Text + "', '"; insertSQL += TextBox19.Text + "', '"; insertSQL += TextBox20.Text + "', '"; insertSQL += "')"; SqlCommand cmd = new SqlCommand(insertSQL, myConnection); int added = 0; added = cmd.ExecuteNonQuery(); Label1.Text = added.ToString() + " records inserted."; } finally { myConnection.Close(); Label1.Text += "<br /><b>Connection Is:</b> " + myConnection.State.ToString(); } } Thanks in advance

                  G Offline
                  G Offline
                  Greg Chelstowski
                  wrote on last edited by
                  #8

                  I see the thread switched locations, but still blossoms... Let's wait till it moves again, because I think all the information provided to that guy is totally irrelevant to him.

                  var question = (_2b || !(_2b));

                  A 1 Reply Last reply
                  0
                  • S sumanmks

                    hi sir, Can i know y there will be a pop up message when i run the project saying that Visual Studio just in-time debugger

                    A Offline
                    A Offline
                    Abhishek Sur
                    wrote on last edited by
                    #9

                    In the browser? or in your debug environment ? Also can you show the exact message, may be a snap. This would help me what exactly the error might be. Sometimes if IE script debugging is disabled, it VS prompts an error message... I guess if it is your case.. :confused:

                    Abhishek Sur


                    My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

                    **Don't forget to click "Good Answer" if you like to.

                    S 1 Reply Last reply
                    0
                    • G Greg Chelstowski

                      I see the thread switched locations, but still blossoms... Let's wait till it moves again, because I think all the information provided to that guy is totally irrelevant to him.

                      var question = (_2b || !(_2b));

                      A Offline
                      A Offline
                      Abhishek Sur
                      wrote on last edited by
                      #10

                      :-D :-D Really.. Its a cross post again. :-D

                      Abhishek Sur


                      My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

                      **Don't forget to click "Good Answer" if you like to.

                      1 Reply Last reply
                      0
                      • A Abhishek Sur

                        In the browser? or in your debug environment ? Also can you show the exact message, may be a snap. This would help me what exactly the error might be. Sometimes if IE script debugging is disabled, it VS prompts an error message... I guess if it is your case.. :confused:

                        Abhishek Sur


                        My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

                        **Don't forget to click "Good Answer" if you like to.

                        S Offline
                        S Offline
                        sumanmks
                        wrote on last edited by
                        #11

                        hi abhishek IE script debugging is disabled is my problem can u please tell me how to get rid of this problem.

                        1 Reply Last reply
                        0
                        • S sumanmks

                          hi i am very new to asp.net. It may be the simplest problem to u. but for me it is a bit difficult. I have written a code for inserting the values in the SQLEXPRESS in C#.but not able to insert it. Can Any one help me out. the code is as follows: protected void Button1_Click1(object sender, EventArgs e) { SqlConnection myConnection = new SqlConnection(); myConnection.ConnectionString = @"Data Source=localhost\SQLEXPRESS;" + "Initial Catalog=testdata;Integrated Security=SSPI"; try { myConnection.Open(); Label1.Text = "<b>Server Version:</b> " + myConnection.ServerVersion; Label1.Text += "<br /><b>Connection Is:</b> " + myConnection.State.ToString(); string insertSQL; insertSQL = "INSERT INTO jobseekerinfo ("; insertSQL += "firstname, middlename, lastname, "; insertSQL += "dob, address, city, state, zip, mobile, phone, engcollege, "; insertSQL += "enguniversity, engaggergate, pucollege, puuniversity, pumarks,"; insertSQL += "school, scuniversity, scmarks, totalyears, totalmonths,"; insertSQL += "workplace, job, skills"; insertSQL += "VALUES ('"; insertSQL += TextBox1.Text + "', '"; insertSQL += TextBox2.Text + "', '"; insertSQL += TextBox3.Text + "', '"; insertSQL += TextBox29.Text + "', '"; insertSQL += TextBox5.Text + "', '"; insertSQL += TextBox11.Text + "', '"; insertSQL += TextBox12.Text + "', '"; insertSQL += TextBox14.Text + "', '"; insertSQL += TextBox6.Text + "', '"; insertSQL += TextBox15.Text + "', '"; insertSQL += TextBox4.Text + "', '"; insertSQL += TextBox8.Text + "', '"; insertSQL += TextBox9.Text + "', '"; insertSQL += TextBox10.Text + "', '"; insertSQL += TextBox30.Text + "', '"; insertSQL += TextBox31.Text + "', '"; insertSQL += TextBox32.Text + "', '"; insertSQL += TextBox33.Text + "', '"; insertSQL += TextBox34.Text + "', '"; insertSQL += TextBox35.Text + "', '"; insertSQL += TextBox36.Text + "', '"; insertSQL += TextBox18.Text + "', '"; insertSQL += TextBox19.Text + "', '"; insertSQL += TextBox20.Text + "', '"; insertSQL += "')"; SqlCommand cmd = new SqlCommand(insertSQL, myConnection); int added = 0; added = cmd.ExecuteNonQuery(); Label1.Text = added.ToString() + " records inserted."; } finally { myConnection.Close(); Label1.Text += "<br /><b>Connection Is:</b> " + myConnection.State.ToString(); } } Thanks in advance

                          V Offline
                          V Offline
                          Vasudevan Deepak Kumar
                          wrote on last edited by
                          #12

                          Two points: 1) You would need to explicitly tell what is the error you are encountering. 2) Your code is highly vulnerable to SQL Injection attacks. You may need to address that first in case you are interested in the safety of your application seriously.

                          Vasudevan Deepak Kumar Personal Homepage
                          Tech Gossips
                          The woods are lovely, dark and deep, But I have promises to keep, And miles to go before I sleep, And miles to go before I sleep!

                          1 Reply Last reply
                          0
                          • S sumanmks

                            hi i am very new to asp.net. It may be the simplest problem to u. but for me it is a bit difficult. I have written a code for inserting the values in the SQLEXPRESS in C#.but not able to insert it. Can Any one help me out. the code is as follows: protected void Button1_Click1(object sender, EventArgs e) { SqlConnection myConnection = new SqlConnection(); myConnection.ConnectionString = @"Data Source=localhost\SQLEXPRESS;" + "Initial Catalog=testdata;Integrated Security=SSPI"; try { myConnection.Open(); Label1.Text = "<b>Server Version:</b> " + myConnection.ServerVersion; Label1.Text += "<br /><b>Connection Is:</b> " + myConnection.State.ToString(); string insertSQL; insertSQL = "INSERT INTO jobseekerinfo ("; insertSQL += "firstname, middlename, lastname, "; insertSQL += "dob, address, city, state, zip, mobile, phone, engcollege, "; insertSQL += "enguniversity, engaggergate, pucollege, puuniversity, pumarks,"; insertSQL += "school, scuniversity, scmarks, totalyears, totalmonths,"; insertSQL += "workplace, job, skills"; insertSQL += "VALUES ('"; insertSQL += TextBox1.Text + "', '"; insertSQL += TextBox2.Text + "', '"; insertSQL += TextBox3.Text + "', '"; insertSQL += TextBox29.Text + "', '"; insertSQL += TextBox5.Text + "', '"; insertSQL += TextBox11.Text + "', '"; insertSQL += TextBox12.Text + "', '"; insertSQL += TextBox14.Text + "', '"; insertSQL += TextBox6.Text + "', '"; insertSQL += TextBox15.Text + "', '"; insertSQL += TextBox4.Text + "', '"; insertSQL += TextBox8.Text + "', '"; insertSQL += TextBox9.Text + "', '"; insertSQL += TextBox10.Text + "', '"; insertSQL += TextBox30.Text + "', '"; insertSQL += TextBox31.Text + "', '"; insertSQL += TextBox32.Text + "', '"; insertSQL += TextBox33.Text + "', '"; insertSQL += TextBox34.Text + "', '"; insertSQL += TextBox35.Text + "', '"; insertSQL += TextBox36.Text + "', '"; insertSQL += TextBox18.Text + "', '"; insertSQL += TextBox19.Text + "', '"; insertSQL += TextBox20.Text + "', '"; insertSQL += "')"; SqlCommand cmd = new SqlCommand(insertSQL, myConnection); int added = 0; added = cmd.ExecuteNonQuery(); Label1.Text = added.ToString() + " records inserted."; } finally { myConnection.Close(); Label1.Text += "<br /><b>Connection Is:</b> " + myConnection.State.ToString(); } } Thanks in advance

                            H Offline
                            H Offline
                            hemant kaushal
                            wrote on last edited by
                            #13

                            insertSQL += "workplace, job, skills"; insertSQL += "VALUES ('"; output of above line will be workplace, job, skillsValues (' so it will give syntax error when executed on database change your code to

                            insertSQL += " workplace, job, skills ";
                            insertSQL += " VALUES('";

                            always remember to add proper spaces between keywords when u are createng query through code.

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups