Witam. Mam prostą funkcję która ma aktualizować 3 pola w bazie danych:
[Kod C#]
String ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\BENDIKS;Extended Properties=dBASE IV;User ID=Admin;Password=;";
String CommandString = "UPDATE C:\BENDIKS\MAGAZYN\" + PARAMETR_1.Substring(0, 1) + "_DANE.DBF SET DO_WYDANIA = @PARAMETR_2, KTO_WPLYN = @PARAMETR_3, DATA_WPLYN = @PARAMETR_4 WHERE INDEX_CZ = @PARAMETR_1";
OleDbConnection Connection = new OleDbConnection(ConnectionString);
OleDbCommand Command = new OleDbCommand(CommandString, Connection);
Command.Parameters.Add("@PARAMETR_1", OleDbType.Char, 7);
Command.Parameters["@PARAMETR_1"].Value = PARAMETR_1;
Command.Parameters.Add("@PARAMETR_2", OleDbType.Numeric, 6);
Command.Parameters["@PARAMETR_2"].Value = Convert.ToDecimal(PARAMETR_2);
Command.Parameters.Add("@PARAMETR_3", OleDbType.Char, 23);
Command.Parameters["@PARAMETR_3"].Value = PARAMETR_3.ToUpper();
Command.Parameters.Add("@PARAMETR_4", OleDbType.Date);
Command.Parameters["@PARAMETR_4"].Value = Convert.ToDateTime(PARAMETR_4);
Connection.Open();
Command.ExecuteNonQuery();
Connection.Close();
Niestety nie działa, nie są zgłaszane też zadne błędy. Ktoś może wie gdzie tkwi bład. Dodam że pracuje na plikach *.dbf
pozdro