1
Answer

INSERT SQL ERROR C# Access Database

David Smith

David Smith

11y
1.7k
1
Can somebody tell me whats wrong with my sql command below. I am getting an syntax error below

                                                      string UserName,
                                                        string Login,
                                                        string Role,
                                                        bool? IsActive,
                                                        string Password,
                                                        bool? IsEditor,
                                                        DateTime UserCreated,
                                                        DateTime UserModified,
                                                        string UserNotes

    string sql = string.Format("INSERT INTO usertable ( UserName, Login, Role, IsActive, Password, IsEditor, UserCreated, UserModified, UserNotes ) " +
                                                                            "VALUES ( '{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}' ); ",
                                                                            UserName,
                                                                            Login,
                                                                            Role,
                                                                            IsActive,
                                                                            Password,
                                                                            IsEditor,
                                                                            UserCreated,
                                                                            UserModified,
                                                                            UserNotes
                                                                            );

Answers (1)