这是程序中已执行查询的示例:
Int64 kooid = new Int64();
myCommand.CommandText = ("SELECT kooiid FROM kooien where NummerExtern =?NummerExtern");
myCommand.Parameters.Add("?NummerExtern", MySqlDbType.Int64).Value = kooi.Kooinr;
kooid = Convert.ToInt64(myCommand.ExecuteScalar());
return kooid;
这是餐桌化妆的一个例子
kooiid(int)| kooidlistppg(int)|quarantaine(tiny int) |idvogelsoort(int)|idvogelondersoort(int)| vasteoflossekooie(tiny int)| bezetofniet(tiny int)| idsponsor(int)| NummerExtern(int)
在您问我何时手动运行查询之前,它可以正常运行,但当程序正确排序时,即使kooinr变量正确,查询也会向kooiid返回零
最佳答案
找到了解决方案
Int64 kooid = new Int64();
myCommand.CommandText = ("Select kooiid from kooien where NummerExtern = ?NummerExtern");
myCommand.Parameters.Add("?NummerExtern", MySqlDbType.Int64).Value = kooi.Kooinr;
string kooidstring = myCommand.ExecuteScalar().ToString();
kooid = Convert.ToInt64(kooidstring);
return kooid;