Visa ett inlägg
Oläst 2014-03-18, 22:26 #4
coredevs avatar
coredev coredev är inte uppkopplad
Bara ett inlägg till!
 
Reg.datum: Sep 2007
Inlägg: 1 554
coredev coredev är inte uppkopplad
Bara ett inlägg till!
coredevs avatar
 
Reg.datum: Sep 2007
Inlägg: 1 554
Din kod ser OK ut (saxat från http://msdn.microsoft.com/en-us/libr...vs.110%29.aspx )
Kod:
using (OdbcConnection connection = 
               new OdbcConnection(connectionString))
    {
        // The insertSQL string contains a SQL statement that 
        // inserts a new row in the source table.
        OdbcCommand command = new OdbcCommand(insertSQL, connection);

        // Open the connection and execute the insert command. 
        try
        {
            connection.Open();
            command.ExecuteNonQuery();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
        // The connection is automatically closed when the 
        // code exits the using block.
    }
Men du behöver ge oss felmeddelande och din SQL-sträng om du behöver hjälp.
coredev är inte uppkopplad   Svara med citatSvara med citat