Click here to Skip to main content
15,902,445 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to change utc Date in a normal Date Pin
jschell29-Jan-16 12:26
jschell29-Jan-16 12:26 
AnswerRe: How to change utc Date in a normal Date Pin
Eddy Vluggen28-Jan-16 3:19
professionalEddy Vluggen28-Jan-16 3:19 
AnswerRe: How to change utc Date in a normal Date Pin
Midi_Mick28-Jan-16 14:00
professionalMidi_Mick28-Jan-16 14:00 
AnswerRe: How to change utc Date in a normal Date Pin
John Torjo28-Jan-16 19:54
professionalJohn Torjo28-Jan-16 19:54 
AnswerRe: How to change utc Date in a normal Date Pin
Member 1191673528-Jan-16 20:41
Member 1191673528-Jan-16 20:41 
GeneralRe: How to change utc Date in a normal Date Pin
Richard MacCutchan28-Jan-16 22:38
mveRichard MacCutchan28-Jan-16 22:38 
AnswerRe: How to change utc Date in a normal Date Pin
jschell29-Jan-16 12:23
jschell29-Jan-16 12:23 
QuestionC# Application updated database. Pin
Ibrahim.elh28-Jan-16 0:07
Ibrahim.elh28-Jan-16 0:07 
Hello Eerry Body,

I'm working on an application in C # which allows to upgrade a Postgresql database to another database.
here is my code

C#
namespace insert
{
    class Program
    {
        static void Main(string[] args)
        {
 
 
                    string connString = "DSN=pg_prd;Database=RPD;User Id=postgres;Password=*****;";
                    OdbcConnection conn = new OdbcConnection(connString);
                  OdbcCommand command = conn.CreateCommand();
                    command.CommandText = "Select etb,nobl,poidsb from t_thisdet";
                    conn.Open();
 
                   OdbcDataAdapter MyAdapter = new OdbcDataAdapter();
                    MyAdapter.SelectCommand = command;
                    DataSet dset = new DataSet("t_thisdet");
                    DataTable ds1 = new DataTable("ds1");
                    MyAdapter.Fill(ds1);
                    conn.Close();
 
 
                    string conn1String = "DSN=testing;Database=RPD;User Id=postgres;Password=****;";
                    OdbcConnection conn1 = new OdbcConnection(conn1String);
                    OdbcCommand command2 = conn1.CreateCommand();
                    conn1.Open();
                 for (int k = 1; k < ds1.Rows.Count; k++)
                    {
 
                 	string etb= ds1.Rows[k][@"etb"].ToString();
                 	string nobl = ds1.Rows[k][@"nobl"].ToString();
                 	string poidsb = ds1.Rows[k][@"poidsb"].ToString();
 
 
                       command2.CommandText="insert into hisdet values ('"+etb+"',"+nobl+","+poidsb+")";
 
 
                       command2.ExecuteNonQuery();
 
 
                 }
 
 
                    conn1.Close();
 
                }

When I run my code I have this error :

System.Data.Odbc.OdbcException: ERROR [42601] ERROR: INSERT has more expressions than target columns;
Error while executing the query.

While the structure of the select query is equal to the structure of the inserte request.
you have some idea about this.
thank you for your help.
AnswerRe: C# Application updated database. Pin
Garth J Lancaster28-Jan-16 0:42
professionalGarth J Lancaster28-Jan-16 0:42 
GeneralRe: C# Application updated database. Pin
Ibrahim.elh28-Jan-16 0:51
Ibrahim.elh28-Jan-16 0:51 
AnswerRe: C# Application updated database. Pin
OriginalGriff28-Jan-16 0:45
mveOriginalGriff28-Jan-16 0:45 
GeneralRe: C# Application updated database. Pin
Ibrahim.elh28-Jan-16 1:13
Ibrahim.elh28-Jan-16 1:13 
GeneralRe: C# Application updated database. Pin
OriginalGriff28-Jan-16 1:24
mveOriginalGriff28-Jan-16 1:24 
GeneralRe: C# Application updated database. Pin
Richard Deeming28-Jan-16 1:29
mveRichard Deeming28-Jan-16 1:29 
GeneralRe: C# Application updated database. Pin
Ibrahim.elh28-Jan-16 1:36
Ibrahim.elh28-Jan-16 1:36 
GeneralRe: C# Application updated database. Pin
Richard Deeming28-Jan-16 1:39
mveRichard Deeming28-Jan-16 1:39 
GeneralRe: C# Application updated database. Pin
Ibrahim.elh28-Jan-16 1:57
Ibrahim.elh28-Jan-16 1:57 
GeneralRe: C# Application updated database. Pin
Richard Deeming28-Jan-16 2:06
mveRichard Deeming28-Jan-16 2:06 
GeneralRe: C# Application updated database. Pin
Ibrahim.elh28-Jan-16 2:29
Ibrahim.elh28-Jan-16 2:29 
GeneralRe: C# Application updated database. Pin
Richard Deeming28-Jan-16 2:34
mveRichard Deeming28-Jan-16 2:34 
GeneralRe: C# Application updated database. Pin
Ibrahim.elh28-Jan-16 3:19
Ibrahim.elh28-Jan-16 3:19 
GeneralRe: C# Application updated database. Pin
Ibrahim.elh28-Jan-16 4:15
Ibrahim.elh28-Jan-16 4:15 
GeneralRe: C# Application updated database. Pin
Richard Deeming28-Jan-16 4:21
mveRichard Deeming28-Jan-16 4:21 
GeneralRe: C# Application updated database. Pin
Ibrahim.elh28-Jan-16 4:34
Ibrahim.elh28-Jan-16 4:34 
GeneralRe: C# Application updated database. Pin
Ibrahim.elh28-Jan-16 5:41
Ibrahim.elh28-Jan-16 5:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.