- C# code
//自己配置的DSN连接没有问题string ConnectionString = "Dsn=Kaiser";using (OdbcConnection tempCon = new OdbcConnection()){ tempCon.ConnectionString = ConnectionString; tempCon.Open(); //可以正常连接 Console.WriteLine(tempCon.State.ToString()); OdbcCommand tempCmd = tempCon.CreateCommand(); //错误出在这里,不知道如何配置输入参数(以及输入参数的前缀) tempCmd.CommandText = "insert into Stu_BasicInfo(StuID, StuName) values(@StuID, @StuName)"; tempCmd.Parameters.Add("@StuID", OdbcType.VarChar, 36, "StuID").Value = Guid.NewGuid().ToString(); tempCmd.Parameters.Add("@StuName", OdbcType.VarChar, 200, "StuName").Value = "Kaiser"; tempCmd.ExecuteNonQuery();}
因为从来没接触过vpf,纯属给朋友帮忙,不过卡在了最基本的技术点上了。希望各位兄弟们支持一下。谢谢
------解决方案--------------------------------------------------------
tempCmd.CommandText = "insert into Stu_BasicInfo(StuID, StuName) values("+@StuID+", "+@StuName+")";