public DataTable Liste()
{
SqlConnection con = new SqlConnection("Data Source=DESKTOP-JHLF03K\\SQLEXPRESS;Initial Catalog=OtelWebSite;Integrated Security=True");
string sql = "";
SqlDataAdapter dap = new SqlDataAdapter(sql, con);
DataTable table = new DataTable();
con.Open();
dap.Fill(table);
sql += "SELECT ";
sql += "O.Id, ";
sql += "O.OdaTurId,";
sql += "T.Ad AS OdaTur, ";
sql += "O.Ad, ";
sql += "O.KatNo, ";
sql += "O.Aciklama, ";
sql += "K.Tanim AS Durum ";
sql += "FROM Oda O, Kod K,OdaTur T ";
sql += "WHERE O.Durum = K.Kod ";
sql += "AND T.Id = O.OdaTurId ";
sql += "ORDER BY O.Id,O.OdaTurId";
con.Close();
return table;
}
我遇到错误
ExecuteReader:CommandText属性未初始化
在此代码行上:
dap.Fill(table);
答案 0 :(得分:1)
您无法执行并清空SQL查询。 将您的sql查询创建移动到创建DataAdapter的行之前的顶部
set path=%path%;c:\python\dlls
pyinstaller ....