3
Reply

Error messege: no value given for one or more required parameters

arun kumar

arun kumar

Apr 21 2012 1:44 AM
5.2k
This is my code, i have a error in no value given for one or more required parameters, please kindly solve these problem, help me

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

namespace testsearch
{
    public partial class Form1 : Form
    {

        OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\ARUNKUMAR\\myproject\\myprojects\\data\\as.accdb");
     OleDbCommand com;
        string str;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string str = "select * from purmonth where cusid =" + textBox1.Text;

            com = new OleDbCommand(str, con);

            DataSet vds = new DataSet();
            OleDbDataAdapter vda = new OleDbDataAdapter(com);
            vda.Fill(vds, "res");

            dataGridView1.DataSource = vds.Tables["res"];
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            con.Open();

        }
    }
}

Thanking you


Answers (3)