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. need help urgent (how to done connectivity with database)

need help urgent (how to done connectivity with database)

Scheduled Pinned Locked Moved ASP.NET
databasecsharpsql-servercomsysadmin
10 Posts 4 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.
  • J Offline
    J Offline
    Jas 007
    wrote on last edited by
    #1

    Hi friends i have done following coding for making a simple guestbook.where i define Name,Email , Location and meesage . I want to store all the values in database when i click on button . i dont know how to do this . coz im new in programming. plz reply me on manvikaur2@gmail.com. if anyone knows . ---------------------------------------------------------------------------- Guestbook.NET

    Guestbook.NET

    Post New Entry


    Name:

    E-mail:

    Location:

    Message:

    ---------------------------------------------------------------------------- i try to connect with SQL server 2005 after creating the table. but not able to done this .

    A R N 3 Replies Last reply
    0
    • J Jas 007

      Hi friends i have done following coding for making a simple guestbook.where i define Name,Email , Location and meesage . I want to store all the values in database when i click on button . i dont know how to do this . coz im new in programming. plz reply me on manvikaur2@gmail.com. if anyone knows . ---------------------------------------------------------------------------- Guestbook.NET

      Guestbook.NET

      Post New Entry


      Name:

      E-mail:

      Location:

      Message:

      ---------------------------------------------------------------------------- i try to connect with SQL server 2005 after creating the table. but not able to done this .

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

      jasjit 007 wrote:

      i try to connect with SQL server 2005 after creating the table. but not able to done this .

      Why ? What problem are you getting ? Did you tried with google ?

      cheers, Abhijit

      J 1 Reply Last reply
      0
      • J Jas 007

        Hi friends i have done following coding for making a simple guestbook.where i define Name,Email , Location and meesage . I want to store all the values in database when i click on button . i dont know how to do this . coz im new in programming. plz reply me on manvikaur2@gmail.com. if anyone knows . ---------------------------------------------------------------------------- Guestbook.NET

        Guestbook.NET

        Post New Entry


        Name:

        E-mail:

        Location:

        Message:

        ---------------------------------------------------------------------------- i try to connect with SQL server 2005 after creating the table. but not able to done this .

        R Offline
        R Offline
        raushan_9
        wrote on last edited by
        #3

        I think u need to add runat="server" on input type control...

        J 1 Reply Last reply
        0
        • R raushan_9

          I think u need to add runat="server" on input type control...

          J Offline
          J Offline
          Jas 007
          wrote on last edited by
          #4

          :(( hi sir , i think u r not understanding the prob.i want to make a assignemt . when i click on button all the data will be store in SQL sever 2005 . i have created the web.config file where i define the connection string. now how to define the table.but im not able to do this .plz run the code in microsoft visual studio if u have Thanks Jasjit

          1 Reply Last reply
          0
          • A Abhijit Jana

            jasjit 007 wrote:

            i try to connect with SQL server 2005 after creating the table. but not able to done this .

            Why ? What problem are you getting ? Did you tried with google ?

            cheers, Abhijit

            J Offline
            J Offline
            Jas 007
            wrote on last edited by
            #5

            hi sir , i think u r not understanding the prob.i want to make a assignemt . when i click on button all the data will be store in SQL sever 2005 . i have created the web.config file where i define the connection string. now how to define the table.but im not able to do this .plz run the code in microsoft visual studio if u have Thanks Jasjit

            1 Reply Last reply
            0
            • J Jas 007

              Hi friends i have done following coding for making a simple guestbook.where i define Name,Email , Location and meesage . I want to store all the values in database when i click on button . i dont know how to do this . coz im new in programming. plz reply me on manvikaur2@gmail.com. if anyone knows . ---------------------------------------------------------------------------- Guestbook.NET

              Guestbook.NET

              Post New Entry


              Name:

              E-mail:

              Location:

              Message:

              ---------------------------------------------------------------------------- i try to connect with SQL server 2005 after creating the table. but not able to done this .

              N Offline
              N Offline
              NidhiKanu
              wrote on last edited by
              #6

              What is your code for make connection,where did u get problem

              J 1 Reply Last reply
              0
              • N NidhiKanu

                What is your code for make connection,where did u get problem

                J Offline
                J Offline
                Jas 007
                wrote on last edited by
                #7

                Hi nidhi , im sending u code for connectivey. plz tell me whr is the prob . i want to submit all the data in databse when i click on button . i define web.config .but prob is not solved. public partial class _Default : System.Web.UI.Page { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString); SqlCommand cmd = new SqlCommand(); protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { conn.Open(); cmd.Connection = con; cmd.CommandText = "insert into guest values(@Name ,@email ,@location,@Message)"; }

                N 1 Reply Last reply
                0
                • J Jas 007

                  Hi nidhi , im sending u code for connectivey. plz tell me whr is the prob . i want to submit all the data in databse when i click on button . i define web.config .but prob is not solved. public partial class _Default : System.Web.UI.Page { SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString); SqlCommand cmd = new SqlCommand(); protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { conn.Open(); cmd.Connection = con; cmd.CommandText = "insert into guest values(@Name ,@email ,@location,@Message)"; }

                  N Offline
                  N Offline
                  NidhiKanu
                  wrote on last edited by
                  #8

                  Could you pls send me web.config code also,one more thing is there have u debug ur code,i think when u'll click on button it will not go to your this event: protected void Button1_Click(object sender, EventArgs e) { conn.Open(); cmd.Connection = con; cmd.CommandText = "insert into guest values(@Name ,@email ,@location,@Message)"; } pls debug ur code and then let me know that ur debugger is going to this event or not.

                  J 1 Reply Last reply
                  0
                  • N NidhiKanu

                    Could you pls send me web.config code also,one more thing is there have u debug ur code,i think when u'll click on button it will not go to your this event: protected void Button1_Click(object sender, EventArgs e) { conn.Open(); cmd.Connection = con; cmd.CommandText = "insert into guest values(@Name ,@email ,@location,@Message)"; } pls debug ur code and then let me know that ur debugger is going to this event or not.

                    J Offline
                    J Offline
                    Jas 007
                    wrote on last edited by
                    #9

                    no nidhi this is not the prob. it goes to that event. i m sending u my web.config file

                    N 1 Reply Last reply
                    0
                    • J Jas 007

                      no nidhi this is not the prob. it goes to that event. i m sending u my web.config file

                      N Offline
                      N Offline
                      NidhiKanu
                      wrote on last edited by
                      #10

                      You r trying to fetching connectino from web.config using this code : SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString); but you have not define connection in web.config. please write this code in your web.config and update :you sql server name, your database name,userid for accessing database,password for accessing database

                      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