I'm getting an error in this code that completely baffles me, any help, ides, suggestions are appreciated.
I have the following code in place: Sub addauthorsearch(ByVal objconn As SQLiteConnection, ByVal author As String, ByVal searchname As String) Dim myTrans As SQLiteTransaction Dim objCommand As SQLiteCommand Dim authorid As Integer myTrans = objconn.BeginTransaction << snipped authorid is retrieved in here>> objCommand = objconn.CreateCommand() 'objCommand.CommandText = "INSERT INTO [authorsearch] ([searchid],[authorid] ) VALUES ('" & searchname & "', '" & authorid & "');" objCommand.CommandText = "INSERT INTO [authorsearch] ([searchid],[authorid] ) VALUES (@name, @id);" objCommand.Parameters.Clear() objCommand.Parameters.Add(New SQLiteParameter("@name", searchname)) ' * error occurs here objCommand.Parameters.Add(New SQLiteParameter("@id", authorid)) Try objCommand.ExecuteNonQuery() Catch ex As InvalidOperationException MessageBox.Show("An error has occurred: " & ex.Message) Catch ex As SQLiteException MessageBox.Show("An error has occurred: " & ex.Message) End Try myTrans.Commit() the database is defined (in the create) as CREATE TABLE authorsearch (searchid VARCHAR (150) NOT NULL UNIQUE, authorid INTEGER REFERENCES author (authorid)) the error being returned is an InvalidCastException, specifically Conversion from string "a-itmatov, chingiz" to type 'Integer' is not valid. searchID is defined as vchar, and I see no reason that anything should be attempting to convert it to an integer. The non parameterized statement works, however it fails on names that contain a single quote ( O'Neil for example ) for obvious reasons. Any suggestions would be appreciated. On a related question, obviously translating C# code helps and there are a couple of forums where sqlite and c# are discussed, does anyone know of a forum where VB.NET and sqlite have an area? //al _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users