You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I take the current Dev repo and try to select Datetime column. I get following Error.
System.Runtime.InteropServices.SEHException: 'External component has thrown an exception.'
This exception was originally thrown at this call stack:
DuckDB.NET.Windows.WindowsBindNativeMethods.DuckDBValueInt32(DuckDB.NET.DuckDBResult, long, long) in NativeMethods.Windows.cs
DuckDB.NET.Data.DuckDBDataReader.GetInt32(int) in DuckDBDataReader.cs
DuckDB.NET.Samples.Program.PrintQueryResults(System.Data.Common.DbDataReader) in Program.cs
DuckDB.NET.Samples.Program.AdoNetSamples() in Program.cs
DuckDB.NET.Samples.Program.Main(string[]) in Program.cs
Here is my Sample Project snippet to reproduce it.
private static void AdoNetSamples()
{
if (File.Exists("file.db"))
{
File.Delete("file.db");
}
using var duckDBConnection = new DuckDBConnection("Data Source=file.db");
duckDBConnection.Open();
var command = duckDBConnection.CreateCommand();
command.CommandText = "Create table test2 (id Int, dt TIMESTAMP, string varchar );";
var executeNonQuery = command.ExecuteNonQuery();
command.CommandText = "Insert into test2 values(1,'1992-09-20 11:30:00', 'Xyz');";
executeNonQuery = command.ExecuteNonQuery();
//command.CommandText = "select * from test2;";
//var executeScalar = command.ExecuteScalar();
command.CommandText = "select * from test2;";
var reader = command.ExecuteReader();
PrintQueryResults(reader);
var results = duckDBConnection.Query<FooBar>("SELECT foo, bar FROM integers");
try
{
command.CommandText = "Not a valid Sql statement";
var causesError = command.ExecuteNonQuery();
}
catch (DuckDBException e)
{
Console.WriteLine(e.Message);
}
}
The text was updated successfully, but these errors were encountered:
@RPalejiya If your column is Timestamp, you should not be calling GetInt32. You can call GetValue that works for any type or call one of the specialized GetXXX methods. Please see the updated demo.
Hello,
If I take the current Dev repo and try to select Datetime column. I get following Error.
System.Runtime.InteropServices.SEHException: 'External component has thrown an exception.'
This exception was originally thrown at this call stack:
DuckDB.NET.Windows.WindowsBindNativeMethods.DuckDBValueInt32(DuckDB.NET.DuckDBResult, long, long) in NativeMethods.Windows.cs
DuckDB.NET.Data.DuckDBDataReader.GetInt32(int) in DuckDBDataReader.cs
DuckDB.NET.Samples.Program.PrintQueryResults(System.Data.Common.DbDataReader) in Program.cs
DuckDB.NET.Samples.Program.AdoNetSamples() in Program.cs
DuckDB.NET.Samples.Program.Main(string[]) in Program.cs
Here is my Sample Project snippet to reproduce it.
The text was updated successfully, but these errors were encountered: