Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

my task is to make editing interface for access using asp.net(c#)

$
0
0
i have 3 textboxes in one is to enter bar code and a button(submit) on submitting bar code the minfo and finfo should appear on other textboxes so that they can be edited
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Drawing;

public partial class _Default : System.Web.UI.Page
{
   protected void Page_Load(object sender, EventArgs e)
    {
        string s = System.Configuration.ConfigurationManager.ConnectionStrings["Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Documents and Settings\\Hitech\\Desktop\\JTS.mdb"].ConnectionString;
        SqlConnection con = new SqlConnection(s);
        SqlCommand cmd = new SqlCommand("select * from JTS where barcode='" + TextBox1.Text + "'", con);
        cmd.CommandType = CommandType.Text;
        cmd.Parameters.AddWithValue("@Id", TextBox1.Text);
        cmd.Connection = con;
        con.Open();
        SqlDataReader dr = cmd.ExecuteReader();
        while (dr.Read())
        {
            TextBox2.Text = dr["CNAME"].ToString();
            TextBox3.Text = dr["MNAME"].ToString();
         }
        dr.Close();
        con.Close();
  }
}

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>