TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
arun kumar
NA
13
0
Data type mismatch in criteria expression.
Apr 16 2012 7:50 AM
sir, i have problem insert a values in my access data base i have a error code: Data type mismatch in criteria expression. please kindly help me.
my code is
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 logins
{
public partial class monthpur : 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 monthpur()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox7_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
str = " insert into purmonth (" + "purchasedate," + "paiddate," + "cusid," + "cusname," + "mill," + "item," + "quantity," + "rate," + "debit," + "credit" + " ) values (('" + dateTimePicker1.Text + "'),('" + paidBox.Text + "'),('" + cusBox.Text + "'),('" + cusnameBox.Text + "'),('" + millBox.Text + "'), ('" + comboBox1.SelectedItem + "'),('" + quantityBox.Text + "'), ('" + rateBox.Text + "'),('" + debitBox.Text + "'),('" + creditBox.Text + "'))";
//str = " insert into purmonth values (('" + dateTimePicker1.Text + "'),('" + dateTimePicker2.Text + "'),('" + textBox3.Text + "'),('" + textBox4.Text + "'),('" + textBox5.Text + "'), ('" + comboBox1.SelectedItem + "'),('" + quantityBox.Text + "'), ('" + rateBox.Text + "'),('" + textBox7.Text + "'),('" + creditBox.Text + "'))";
com = new OleDbCommand(str, con);
com.ExecuteNonQuery();
MessageBox.Show("Records Successfully Stored");
// con.Close();
}
private void monthpur_Load(object sender, EventArgs e)
{
con.Open();
}
private void creditBox_TextChanged(object sender, EventArgs e)
{
try
{
creditBox.Text = (decimal.Parse(quantityBox.Text) * decimal.Parse(rateBox.Text)).ToString();
}
catch
{
}
}
}
}
please kindly help me..
Thanking you..
Reply
Answers (
2
)
Internet
XML