hi frndz i m making a project on hospital management in cSharp n in that i have made a form of "patient registration" in that i have taken ten textbox for diff entry....
n i want to coonnect this form with patient detail table in sql in that table i have taken 21 columns so i cannot understand how to insert data in sql bcz when i try to insert data through sqlparameter an expection occurs that table has more columns than parameter used in this form so can sumbody tell me coding for how to insert,show data in sql plzzzzzzzzzzzzzzz plzzzzzzzzzzzzzzzzzzzzz help me


this is third thread plzzzzzzzzzzzzzzzz i haven't get any rep


plzzzzzzzz help me

thx in advance plzzzzzzzzzz help i need it urgently

i also try to bind the data with table but this coding also not work so could u tell me wat to do

string constr = @"Data Source=.;Initial Catalog=LifelineHospital;
                Integrated Security =True;";
        public PatientRegistrationForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string constr=@"Data Source=.;Initial Catalog=LifelineHospital;
                Integrated Security =True;";
            SqlConnection conn = new SqlConnection(constr);
            try
            {
                conn.Open();
            }
            catch (SqlException ex)
            {
                MessageBox.Show("Error in connection ..." + ex.Message);
            }
            string sqlstr = "SELECT * from Patient_Detail";
            SqlDataAdapter  dAdapter = new SqlDataAdapter(sqlstr, conn);
            DataSet dset = new DataSet();
            dAdapter.TableMappings.Add("Table", "Patient_Detail");
            dAdapter.Fill(dset);
            DataViewManager dviewmanager = new DataViewManager();
            dviewmanager = dset.DefaultViewManager;
            this.comboBox1.DataSource = dviewmanager;
            this.comboBox2.DataSource = dviewmanager;
          
            this.textBox1.DataBindings.Add("Text", dset, "Patient_Detail.PatientId");
            this.textBox2.DataBindings.Add("Text", dset, "Patient_Detail.PatientName");
            this.textBox3.DataBindings.Add("Text", dset, "Patient_Detail.PatientAge");
            this.comboBox1.DisplayMember = "Patient_Detail.Gender";
            this.textBox4.DataBindings.Add("Text", dset, "Patient_Detail.Address");
            this.textBox5.DataBindings.Add("Text", dset, "Patient_Detail.ContactRes");
            this.textBox6.DataBindings.Add("Text", dset, "Patient_Detail.Mobile");
            this.textBox10.DataBindings.Add("Text", dset, "Patient_Detail.AdmitDate");
            this.comboBox1.DisplayMember = "Patient_Detail.Department";
            this.textBox7.DataBindings.Add("Text", dset, "Patient_Detail.RoomNo");
            this.textBox8.DataBindings.Add("Text", dset, "Patient_Detail.ReferedFrom");
            this.textBox9.DataBindings.Add("Text", dset, "Patient_Detail.TreatmentBy");
                
            conn.Close();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.