用C#写的winform程序访问Access 在XP的机器上运行正常
拿到win98下sql语句执行不正常
98的机器安装了Framework 1.1 IE5.5 MDAC2.8
想问问有人知道是什么原因么?~谢谢了!~~~急啊~~~~
代码如下
string sql = "select top 1 id from xiaoshou where riqi=#"+da.ToShortDateString()+"# order by id desc";///就是这句在98下查询不出结果~~~~不知道为什么~?但是数据库里明明有符合条件的记录~~~~
try
{
OleDbCommand Cmd = Conn.CreateCommand();
Cmd.CommandText=sql;
Conn.Open();
OleDbDataReader Dr = Cmd.ExecuteReader();
Dr.Read();
if(Dr.HasRows)
{
xiaoshoudanhao=Dr[0].ToString().Replace(y+m+d,"");
int temp = Int32.Parse(xiaoshoudanhao)+1;
xiaoshoudanhao = y+m+d+temp.ToString("000000");
}
else
xiaoshoudanhao = y+m+d+"000001";
Dr.Close();
}
catch(System.Exception Ex)
{
throw Ex;
}
finally
{
if(Conn.State!=0)
Conn.Close();
}
拿到win98下sql语句执行不正常
98的机器安装了Framework 1.1 IE5.5 MDAC2.8
想问问有人知道是什么原因么?~谢谢了!~~~急啊~~~~
代码如下
string sql = "select top 1 id from xiaoshou where riqi=#"+da.ToShortDateString()+"# order by id desc";///就是这句在98下查询不出结果~~~~不知道为什么~?但是数据库里明明有符合条件的记录~~~~
try
{
OleDbCommand Cmd = Conn.CreateCommand();
Cmd.CommandText=sql;
Conn.Open();
OleDbDataReader Dr = Cmd.ExecuteReader();
Dr.Read();
if(Dr.HasRows)
{
xiaoshoudanhao=Dr[0].ToString().Replace(y+m+d,"");
int temp = Int32.Parse(xiaoshoudanhao)+1;
xiaoshoudanhao = y+m+d+temp.ToString("000000");
}
else
xiaoshoudanhao = y+m+d+"000001";
Dr.Close();
}
catch(System.Exception Ex)
{
throw Ex;
}
finally
{
if(Conn.State!=0)
Conn.Close();
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货