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. General Programming
  3. C#
  4. cannot insert into database 2005 using visual c# 2008

cannot insert into database 2005 using visual c# 2008

Scheduled Pinned Locked Moved C#
databasehelpcsharpsql-serversysadmin
6 Posts 3 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.
  • A Offline
    A Offline
    Adekolurejo
    wrote on last edited by
    #1

    Hello, Please I need very urgent solution to this problem. I have an application writing in C# using sql server 2005 express and visual c# 2008 express. I want to connect and insert data to the database from textbox. Onclick on save button I want the data to be submited into database. I dont want to use the manual way of connecting to databse because the db server will not be on my local maching after the completion of the project. I also want to update retrive data from database and update them as well. Am just learning C# on my own and this is beyond my ability at the moment. Please help me. Waiting for your kind reply Thanks, Ademola

    R S 2 Replies Last reply
    0
    • A Adekolurejo

      Hello, Please I need very urgent solution to this problem. I have an application writing in C# using sql server 2005 express and visual c# 2008 express. I want to connect and insert data to the database from textbox. Onclick on save button I want the data to be submited into database. I dont want to use the manual way of connecting to databse because the db server will not be on my local maching after the completion of the project. I also want to update retrive data from database and update them as well. Am just learning C# on my own and this is beyond my ability at the moment. Please help me. Waiting for your kind reply Thanks, Ademola

      R Offline
      R Offline
      Ravi Mori
      wrote on last edited by
      #2

      I think following link will help you for basic insert,update and delete operations in sql using c#. Beginners guide to accessing SQL Server through C#

      A 1 Reply Last reply
      0
      • A Adekolurejo

        Hello, Please I need very urgent solution to this problem. I have an application writing in C# using sql server 2005 express and visual c# 2008 express. I want to connect and insert data to the database from textbox. Onclick on save button I want the data to be submited into database. I dont want to use the manual way of connecting to databse because the db server will not be on my local maching after the completion of the project. I also want to update retrive data from database and update them as well. Am just learning C# on my own and this is beyond my ability at the moment. Please help me. Waiting for your kind reply Thanks, Ademola

        S Offline
        S Offline
        saurabh sahay
        wrote on last edited by
        #3

        You may also consider storing all the SQL DB connection information in an XML file instead of hardcoding.

        A 1 Reply Last reply
        0
        • S saurabh sahay

          You may also consider storing all the SQL DB connection information in an XML file instead of hardcoding.

          A Offline
          A Offline
          Adekolurejo
          wrote on last edited by
          #4

          Thanks for you answer pleas how do I do that?

          S 1 Reply Last reply
          0
          • R Ravi Mori

            I think following link will help you for basic insert,update and delete operations in sql using c#. Beginners guide to accessing SQL Server through C#

            A Offline
            A Offline
            Adekolurejo
            wrote on last edited by
            #5

            Thank you for the link. I'm now stock here SqlCommand myCommand= new SqlCommand("INSERT INTO table (Column1, Column2) " + "Values ('string', 1)", myConnection); The value is given me problem. How do I get the value from textbox before it can be inserted into batabase. I have design my form and i need to get information from user through the textbox whenever they click the save button on the form. Thanks for your help. Ademola

            1 Reply Last reply
            0
            • A Adekolurejo

              Thanks for you answer pleas how do I do that?

              S Offline
              S Offline
              saurabh sahay
              wrote on last edited by
              #6

              Use System.Xml.XmlDocument in you code to parse the XML document and extract the database name, connection string and other information and save them into your types objects. Use these type objects normally as you do database interaction and transaction.

              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