D DataProtec Member Licensed User Sep 27, 2019 #1 Got a problem to insert new data in MSSQL DB IN VB NET i do aCmd.Parameters.AddWithValue("@UserID", IIf(aktUser_ID = "", DBNull.Value, aktUser_ID)) In V4A i tried what i found in the Fórum, but get the Msg " java.sql.SQLException: Invalid parameter index 1." Public msSQL As JdbcSQL msSQL.ExecNonQuery2("INSERT INTO CheckInOut_Table VALUES('UserID')", Array As Object("56")) What i doing wrong thanks Uli
Got a problem to insert new data in MSSQL DB IN VB NET i do aCmd.Parameters.AddWithValue("@UserID", IIf(aktUser_ID = "", DBNull.Value, aktUser_ID)) In V4A i tried what i found in the Fórum, but get the Msg " java.sql.SQLException: Invalid parameter index 1." Public msSQL As JdbcSQL msSQL.ExecNonQuery2("INSERT INTO CheckInOut_Table VALUES('UserID')", Array As Object("56")) What i doing wrong thanks Uli
rraswisak Active Member Licensed User Longtime User Sep 27, 2019 #2 you should use this way: Code: Copy msSql.ExecNonQuery2("Insert Into CheckInOut Values (?)", Array As Object("56")) i assume that CheckInOut table has only one field. If you have several field then you should explicitly call the field name, example: Code: Copy msSql.ExecNonQuery2("Insert Into Table1 (Field1, Field2) Values (?, ?)", Array As Object(value1, value2)) Upvote 0
you should use this way: Code: Copy msSql.ExecNonQuery2("Insert Into CheckInOut Values (?)", Array As Object("56")) i assume that CheckInOut table has only one field. If you have several field then you should explicitly call the field name, example: Code: Copy msSql.ExecNonQuery2("Insert Into Table1 (Field1, Field2) Values (?, ?)", Array As Object(value1, value2))
D DataProtec Member Licensed User Sep 27, 2019 #3 Hello, thanks for reply I did exactly what you recommend, the DB has more fielda but i need to put this field and if i execute th app it crash with the following Error Code: Copy Error occurred on line: 220 (Main) '*** the with the insert java.sql.SQLException: Invalid parameter index 1. 220 msSQL.ExecNonQuery2("insert into CheckInOut_Table (UserID) Values(56)", Array As Object("56")) Upvote 0
Hello, thanks for reply I did exactly what you recommend, the DB has more fielda but i need to put this field and if i execute th app it crash with the following Error Code: Copy Error occurred on line: 220 (Main) '*** the with the insert java.sql.SQLException: Invalid parameter index 1. 220 msSQL.ExecNonQuery2("insert into CheckInOut_Table (UserID) Values(56)", Array As Object("56"))
rraswisak Active Member Licensed User Longtime User Sep 27, 2019 #4 it should be: Code: Copy msSQL.ExecNonQuery2("insert into CheckInOut_Table (UserID) Values(?)", Array As Object("56")) or Code: Copy msSQL.ExecNonQuery("insert into CheckInOut_Table (UserID) Values(56)") Upvote 0
it should be: Code: Copy msSQL.ExecNonQuery2("insert into CheckInOut_Table (UserID) Values(?)", Array As Object("56")) or Code: Copy msSQL.ExecNonQuery("insert into CheckInOut_Table (UserID) Values(56)")
DonManfred Expert Licensed User Longtime User Sep 27, 2019 #6 DataProtec said: In V4A Click to expand... What is V4A? There is no such thing in B4X DataProtec said: Public msSQL As JdbcSQL msSQL.ExecNonQuery2("INSERT INTO CheckInOut_Table VALUES('UserID')", Array As Object("56")) Click to expand... Please use [CODE]code here...[/CODE] tags when posting code. Last edited: Sep 27, 2019 Upvote 0
DataProtec said: In V4A Click to expand... What is V4A? There is no such thing in B4X DataProtec said: Public msSQL As JdbcSQL msSQL.ExecNonQuery2("INSERT INTO CheckInOut_Table VALUES('UserID')", Array As Object("56")) Click to expand... Please use [CODE]code here...[/CODE] tags when posting code.
D DataProtec Member Licensed User Sep 27, 2019 #7 Ok, sorry normaly i do, but this i don't no, sorry again Upvote 0