Baza je
Uploaded with ImageShack.us
metoda koja to radi je:
public void AzurirajKolicinu(string barcode, int kolicina)
{
SqlCeConnection con = new SqlCeConnection(@"Data Source = |DataDirectory|\intercom.sdf");
con.Open();
SqlCeCommand com = new SqlCeCommand("update prodaja set stanje =" + kolicina.ToString() + " WHERE barcode= " + barcode, con);
com.Parameters.AddWithValue("@stanje", kolicina);
com.ExecuteNonQuery();
con.Close();
Znaci nadji barkod iz baze, i azuriraj njegovo int kolicina polje sa novom vrijednoscu.
Ovo radi ako imam barkodove koji su >= 14 karaktera (primjer: 1234567890123).
Ovo ne radi ako imam barkodove koji su <= od 13 karaktera (123456789012)
Greska koju dobijem je:
exception.message
---------------------------
---------------------------
Expression evaluation caused an overflow. [ Name of function (if known) = ]
---------------------------
OK
---------------------------
Malo detaljnije:
MessageBox.Show(a.InnerException + "\n" + a.Source + "\n" + a.StackTrace + "\n" + a.TargetSite);
SQL Server Compact ADO.NET Data Provider
at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommandText(IntPtr& pCursor, Boolean& isBaseTableCursor)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, resultSetOptions options)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery()
at POSkasa.konekcija.AzurirajKolicinu(String barcode, Int32 kolicina) in C:
Cini mi se da negdje dolazi do kolizije tipa podataka, ali gdje?
[IMG]http://img233.imageshack.us/img233/5078/thumbnailte1.th.jpg[/IMG]
They say I look like daddy :D