[C# + ADO] Problem z dodaniem rekordu do bazy PostgresSQL
Witam :mryellow:
Otóż pisze aplikacje do obsługo bazy danych, jako bazę danych wybrałem Postgres, łączę się z nia za pomocą komponentu ADO - sterownik nplsql do Postgres. Mam problem z dodaniem rekordu do bazy.
[code]private void button2_Click(object sender, EventArgs e)
{
Npgsql.NpgsqlConnection oConn = new Npgsql.NpgsqlConnection("Server=127.0.0.1;Port=5432;User Id=postgres;Password=*********;Database=IP");
oConn.Open();
Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand("INSERT INTO LEND(id_lend,id_item,id_customer,lend_date,return_date) values (DEFAULT, , :id_customer, :lend_date, NULL) ", oConn);
//command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new Npgsql.NpgsqlParameter("id_item", DbType.Int16));
command.Parameters.Add(new Npgsql.NpgsqlParameter("id_customer", DbType.Int16));
command.Parameters.Add(new Npgsql.NpgsqlParameter("lend_date", DbType.Date));
command.Parameters[0].Value = textBox2.ToString();
command.Parameters[1].Value = textBox1.ToString();
command.Parameters[2].Value = textBox3.ToString();
command.ExecuteNonQuery();
oConn.Close();
[/code]
Podczas wpisania danych do pól TextBox, wyskakuje mi taki o to err:
[code]---------------------------
Microsoft Visual C# 2008 Express Edition
---------------------------
Source file: C:\Program Files\Microsoft Visual Studio 9.0\VC#\CSharpProjects\NpgsqlTypeConverters.cs
Module: C:\Documents and Settings\Dom\Moje dokumenty\Visual Studio 2008\Projects\IP_podejscie_2\IP_podejscie_2\bin\Debug\Npgsql.dll
Process: [3728] IP_podejscie_2.vshost.exe
The source file is different from when the module was built. Would you like the debugger to use it anyway?
---------------------------
Tak Nie
---------------------------[/code]
Następnie wyskakuje mi okienko wyboru źródła pliku NpgsqlTypesConvert.cs, wskazuje ten plik, i dostaje błąd 'Input string was not in a correct format.'. Orientuje się może ktoś, gdzie tkwi problem
Odpowiedzi: 0
Strona 0 / 0