【发布时间】:2015-05-31 20:14:01
【问题描述】:
这是代码,谁能帮帮我?
Value = Convert.ToInt32(Console.ReadLine());
switch (Value)
{
case 1:
Console.WriteLine("Please enter number");
number = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please insert the first word");
word1 = Convert.ToString(Console.ReadLine());
Console.WriteLine("Please insert the second word");
word2 = Convert.ToString(Console.ReadLine());
string sql1 = "INSERT INTO storage ('" + number + "', '" + word1 + "', '" + word2 + "')";
one.Update(sql1);
break;
【问题讨论】:
-
它就是我所说的我的类,比如 SimpleDataScource one = new SimpleDataScource
-
为什么人们投票反对?
-
@Mr.Bean 可能是因为数字、word1、word2 的数据类型等信息不完整......有什么例外......
-
@Mr.Bean 顺便说一句,您的 INSERT 语句必须具有要插入的字段值名称
-
您在 sql INSERT 中错过了 VALUES 尝试
string sql1 = "INSERT INTO storage VALUES ('" + number + "', '" + word1 + "', '" + word2 + "')";