




C# Da Database Baglanti Hatasi, Build Yapildiginda Hata Yok , Ama Calisan Program Hata Veriyor
-
http://img686.imageshack.us/img686/1355/hata1.png
hata bu :S
program kodlari http://www.megaupload.com/?d=EM075PKS
-
sql command'ını tam yaz bakalım bi .. t-sql de parametre sıralamada sorun var gibi
-
cemnet bunu yazdı:
-----------------------------
sql command'ını tam yaz bakalım bi .. t-sql de parametre sıralamada sorun var gibi
-----------------------------public static string CON
{
get { return " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\Urunler.mdb"; }
}bu database baglantisini tanittigim urunconnection calssi .
-===============================
region savingproduce
public static void SaveProduce( product myproduct)
{
OleDbConnection cn = new OleDbConnection ( classes.Urunconnetion.CON);
OleDbCommand com = new OleDbCommand(" insert into Urun ( ProduceName, ProduceQuantity, ProduceMadeby, ProduceAdddate, ProducePriceperone, ProducePriceforall, ProduceInformation ) values ( @name , @quantity , @madeby, @adddate, @priceperone, , @priceforall, @information) ", cn);
// com.Parameters.AddWithValue("@id", myproduct.Produceid);
com.Parameters.AddWithValue("@name", myproduct.Producename);
com.Parameters.AddWithValue("@quantity", myproduct.Producequantity);
com.Parameters.AddWithValue("@madeby", myproduct.Producemadeby);
com.Parameters.AddWithValue("@adddate", myproduct.Produceadddate);
com.Parameters.AddWithValue("@priceperone", myproduct.Producepriceperone);
com.Parameters.AddWithValue("@priceforall", myproduct.Producepriceforall);
com.Parameters.AddWithValue("@information", myproduct.Produceinformation);
cn.Open();
com.ExecuteNonQuery();
MessageBox.Show( " Produce data has been saved " );
cn.Close();
}
kayit islemi icin yapilan data tablosu kayiti, tabloya textboxtaki verilerin girildigi kisim.=========================
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "" || textBox1 == null || textBox2.Text == "" || textBox2.Text == null || textBox3.Text == "" || textBox3 == null || textBox4.Text == "" || textBox4 == null || textBox5.Text == "" || textBox5.Text == null || textBox6.Text == "" || textBox6.Text == null)
{
MessageBox.Show(" All textbox must be full ");
}
else
{
classes.product myproduct = new coursework.classes.product(Convert.ToInt32(comboBox1.SelectedItem), textBox1.Text, Convert.ToInt32(textBox2.Text), textBox3.Text, textBox4.Text, Convert.ToInt32(textBox5.Text), Convert.ToInt32(textBox6.Text), textBox7.Text);
DialogResult talk = MessageBox.Show(" Are you sure to save all data ", "Attention ", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
if (talk == DialogResult.OK)
{
if (comboBox1.Text == myproduct.Produceid.ToString())
{
MessageBox.Show("This produces already had been saved ?");
}
}
else
{
classes.product.SaveProduce(myproduct);
classes.product.clearproduce(comboBox1, textBox1, textBox2, textBox3, textBox4, textBox5, textBox6, textBox7);
classes.product.fillcombobox(comboBox1);
comboBox1.SelectedIndex = comboBox1.Items.Count - 1;
}
}
}
}hata bu kaydet butonun satarinda galiba
kolari sagdan soldan bakarak derledim.
-
cozebilen yokmu ?
-
@priceperone, , @priceforal arada boşluk var o olabilir mi
-
UCANTENEKE bunu yazdı:
-----------------------------
@priceperone, , @priceforal arada boşluk var o olabilir mi
-----------------------------iyi yakalamissin :)
bu seferde ayni yerde farkli hata verdi
"data type mismatch in criteria expression"
|-( bu hatasi simdi ...
-
data type hatası demiş işte .. Mesela sayı olarak tanımlanan bir stuna sen harf ekliyosundur falan filan işte ..
-
cemnet bunu yazdı:
-----------------------------
data type hatası demiş işte .. Mesela sayı olarak tanımlanan bir stuna sen harf ekliyosundur falan filan işte ..
-----------------------------hepsine sayisal veri girdim , gene hata veriyor :S
-
cemnet bunu yazdı:
-----------------------------
data type hatası demiş işte .. Mesela sayı olarak tanımlanan bir stuna sen harf ekliyosundur falan filan işte ..
----------------------------- -
oldu :D :D :D
urunmd de data tipine tarih atamisim :)
oldu be !
yardimlariniz icin tesekkurler ...
-
edit: olmuş