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 to save value in Ms Access using asp.net 2.0 C#

how to save value in Ms Access using asp.net 2.0 C#

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasetutorialquestion
6 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.
  • P Offline
    P Offline
    prateekfgiet
    wrote on last edited by
    #1

    HI, i m trying to save value in access database,can i do this if yes then how can i implement. thanx in advance

    R P 3 Replies Last reply
    0
    • P prateekfgiet

      HI, i m trying to save value in access database,can i do this if yes then how can i implement. thanx in advance

      R Offline
      R Offline
      Rajeshwar Code Developer
      wrote on last edited by
      #2

      do u means to insert data into access db.

      try and try untill reach success..

      P 1 Reply Last reply
      0
      • R Rajeshwar Code Developer

        do u means to insert data into access db.

        try and try untill reach success..

        P Offline
        P Offline
        prateekfgiet
        wrote on last edited by
        #3

        yes i can do in sql server,but i want to MsAccess Db. is it possible? how can i do?

        S 1 Reply Last reply
        0
        • P prateekfgiet

          yes i can do in sql server,but i want to MsAccess Db. is it possible? how can i do?

          S Offline
          S Offline
          sashidhar
          wrote on last edited by
          #4

          Try This Link It May Help http://aspalliance.com/429[^] ASP.NET Guestbook using MS Access[^]

          If It Helps Click It as Answer

          1 Reply Last reply
          0
          • P prateekfgiet

            HI, i m trying to save value in access database,can i do this if yes then how can i implement. thanx in advance

            P Offline
            P Offline
            Prabhakar Parihar
            wrote on last edited by
            #5

            Firstly u add   <appSettings> tag in web config file attach data base    <appSettings>       <add key="ConnectionStrings" value="Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}"/>       <add key="dbfile" value="~/App_Data/data.mdb"/>    </appSettings> then after    Pro = ConfigurationManager.AppSettings["ConnectionStrings"].ToString();                         MyPath = ConfigurationManager.AppSettings["dbfile"].ToString();                         Conns = String.Format(Pro, HttpContext.Current.Server.MapPath(MyPath));                         con = new OleDbConnection(Conns);                         con.Open();                         string st = "Madhaya Pradesh";                         string qql = "INSERT into Registration(UniqueID,Name,FName,DOB,TMarks,OMarks,PMarks,PClass,PLine,Board,District,Division,Category,Sex,PChallange,Address,Pin,RDistrict,State,Phone,SchoolAddress,SchoolPincode,SchoolDistrict) values('" + lbluniquid.Text + "','" + txtname.Text + "','" + txtfathername.Text + "','" + tbMyDate.Text + "'," + txttotalmarks.Text + "," + txtobtainmarks.Text + "," + p + ",'" + rdpresent.SelectedItem.Text + "','" + rdpovertyline.SelectedItem.Text + "','" + rdboard.SelectedItem.Text + "','" + ddldistrict.SelectedItem.Text + "','" + lbldivision.Text + "','" + rdcategory.SelectedItem.Text + "','" + rdsex.SelectedItem.Text + "','" + rdphysically.SelectedItem.Text + "','" + txtaddress.Text + "','" + txtpincode.Text + "','" + ddldistrict1.SelectedItem.Text + "','" + st   + "','" + txtcontact.Text + "','"+ txtschooladdress.Text +"','"+ txtschoolpincode.Text +"','"+ ddldistrict2.SelectedItem.Text +"')";                         cmd = new OleDbCommand(qql, con);                         int res;             &nbs

            1 Reply Last reply
            0
            • P prateekfgiet

              HI, i m trying to save value in access database,can i do this if yes then how can i implement. thanx in advance

              P Offline
              P Offline
              Prabhakar Parihar
              wrote on last edited by
              #6

              This code useful for u.. firstly add tag in web config

              After then

              Pro = ConfigurationManager.AppSettings["ConnectionStrings"].ToString();
              MyPath = ConfigurationManager.AppSettings["dbfile"].ToString();
              Conns = String.Format(Pro, HttpContext.Current.Server.MapPath(MyPath));
              con = new OleDbConnection(Conns);
              con.Open();
              string st = "Madhaya Pradesh";
              string qql = "INSERT into Registration(UniqueID,Name,FName,DOB,TMarks,OMarks,PMarks,PClass,PLine,Board,District,Division,Category,Sex,PChallange,Address,Pin,RDistrict,State,Phone,SchoolAddress,SchoolPincode,SchoolDistrict) values('" + lbluniquid.Text + "','" + txtname.Text + "','" + txtfathername.Text + "','" + tbMyDate.Text + "'," + txttotalmarks.Text + "," + txtobtainmarks.Text + "," + p + ",'" + rdpresent.SelectedItem.Text + "','" + rdpovertyline.SelectedItem.Text + "','" + rdboard.SelectedItem.Text + "','" + ddldistrict.SelectedItem.Text + "','" + lbldivision.Text + "','" + rdcategory.SelectedItem.Text + "','" + rdsex.SelectedItem.Text + "','" + rdphysically.SelectedItem.Text + "','" + txtaddress.Text + "','" + txtpincode.Text + "','" + ddldistrict1.SelectedItem.Text + "','" + st + "','" + txtcontact.Text + "','"+ txtschooladdress.Text +"','"+ txtschoolpincode.Text +"','"+ ddldistrict2.SelectedItem.Text +"')";
              cmd = new OleDbCommand(qql, con);
              int res;
              res = cmd.ExecuteNonQuery();
              res = 1;
              con.Close();

              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