本声明中的问题在哪里?
SqlCommand cmd = new SqlCommand("INSERT INTO User_images (Pictures,UserName ) VALUES (@pic1,'" + username.Text + "')(@pic2,'" + username.Text + "')(@pic3,'" + username.Text + "')(@pic4,'" + username.Text + "')(@pic5,'" + username.Text + "')(@pic6,'" + username.Text + "')", con1);
错误是:
“
附近的语法不正确
答案 0 :(得分:0)
每组条目之间没有逗号。语句的SQL部分应如下所示:
INSERT INTO User_images (Pictures,UserName ) VALUES
(@pic1,'" + username.Text + "'), --comma
(@pic2,'" + username.Text + "'), --comma
(@pic3,'" + username.Text + "'), --comma
(@pic4,'" + username.Text + "'), --comma
(@pic5,'" + username.Text + "'), --comma
(@pic6,'" + username.Text + "')