Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 19th, 2007, 11:22 PM
Registered User
 
Join Date: Apr 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mkazim85 Send a message via Yahoo to mkazim85
Default i am facing a problem

actually my name is kazim.i m a final year computer science student.i make a table in access and insert two fields of text type int it.when i insert data in it through c#.then it insert in it correctly, but when i increse the field in the table from 2 to 4.and all are of same data type.then when i insert the data in it,the error is come,that u have not inserted the value for one or more required fields.i will be send u a code.hopefully u will solve my problem.
thanks


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Text;
using System.Windows.Forms;


namespace faproj
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void generalJournal_Click(object sender, EventArgs e)
        {
            this.Debit.Visible = true;
            this.Credit.Visible = true;
            this.accpar.Visible = true;
            this.comboBox1.Visible = true;
            this.comboBox2.Visible = true;
            this.textCredit.Visible = true;
            this.textDebit.Visible = true;


            this.comboBox1.Items.Add("Cash");
            this.comboBox1.Items.Add("Supplies");
            this.comboBox1.Items.Add("Land");
            this.comboBox1.Items.Add("Capital");
            this.comboBox1.Items.Add("Account Recievable");
            this.comboBox1.Items.Add("Buildings");
            this.comboBox1.Items.Add("Note Recievable");
            this.comboBox1.Items.Add("Sales Revenue");
            this.comboBox1.Items.Add("Tools and Equipments");

            this.comboBox1.Items.Add("Account Payable");
            this.comboBox1.Items.Add("Note Payable");
            this.comboBox1.Items.Add("Utility Expenses");
            this.comboBox1.Items.Add("Rent Expense");
            this.comboBox1.Items.Add("Salary Expense");
            this.comboBox1.Items.Add("Salary Payable");
            this.comboBox1.Items.Add("Insurance Expense");
            this.comboBox1.Items.Add("Wedges Expense");


            this.comboBox2.Items.Add("Cash");
            this.comboBox2.Items.Add("Supplies");
            this.comboBox2.Items.Add("Land");
            this.comboBox2.Items.Add("Capital");
            this.comboBox2.Items.Add("Account Recievable");
            this.comboBox2.Items.Add("Buildings");
            this.comboBox2.Items.Add("Note Recievable");
            this.comboBox2.Items.Add("Sales Revenue");
            this.comboBox2.Items.Add("Tools and Equipments");

            this.comboBox2.Items.Add("Account Payable");
            this.comboBox2.Items.Add("Note Payable");
            this.comboBox2.Items.Add("Utility Expenses");
            this.comboBox2.Items.Add("Rent Expense");
            this.comboBox2.Items.Add("Salary Expense");
            this.comboBox2.Items.Add("Salary Payable");
            this.comboBox2.Items.Add("Insurance Expense");
            this.comboBox2.Items.Add("Wedges Expense");

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Connect con = new Connect();
            DataSet ds = new DataSet();

            con.connectivity();
            string az=this.textDebit.Text ;
            string bz =this.textCredit.Text ;
            string cz = this.comboBox1.SelectedItem.ToString();
            string dz = this.comboBox2.SelectedItem.ToString ();

            this.textBox1.Text = az;
            this.textBox2.Text = bz;


            string str = "INSERT INTO Legacy values("+ cz+ "," + dz + "," + az + "," + bz + ")";
            OleDbCommand comm = new OleDbCommand(str ,con.conn);
            comm.ExecuteNonQuery();

            str = "SELECT * FROM Legacy";
            OleDbDataAdapter da = new OleDbDataAdapter(str,con.conn);
            da.Fill(ds,"Legacy");
            this.dataGridView1.DataSource = ds.Tables["Legacy"].DefaultView ;

        }
    }
}

 
Old April 20th, 2007, 01:14 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

What is the structure of the table "Legacy"?

_________________________
- Vijay G
Strive for Perfection
 
Old April 20th, 2007, 07:28 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...

looks like the table has all the fields at requiered (or not null or PK) and you have to pass all the values to it.. show the structure of your table (as asked by Vijay) ...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Facing Problem in WSAD mvharish J2EE 0 May 25th, 2007 04:24 AM
Facing problem with tomcat 5.5.9 bhojrajjoshi Apache Tomcat 14 September 26th, 2006 04:44 AM
facing big problem Manish Malhotra Classic ASP Basics 1 June 19th, 2006 01:35 PM
Facing problem with commandtimeout altaf Classic ASP Databases 0 June 27th, 2003 08:27 AM
Facing problem with commandtimeout altaf SQL Server 2000 0 June 27th, 2003 08:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.