.net 读取access中的长整型数据,是用getIn32()吧。 我在本机上读取成功,但是放到服务器上就报错了
报错内容为:System.InvalidCastException:指定的转换无效。这是网页代码:usingSystem;usingSystem.Collections....
报错内容为:
System.InvalidCastException: 指定的转换无效。
这是网页代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.OleDb;
public partial class t : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Int32 i = 0;
try
{
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.Web.HttpContext.Current.Server.MapPath("~/") + "pic.mdb");
conn.Open();
OleDbCommand comm = new OleDbCommand("select max(PID) from ima", conn);
OleDbDataReader reader = comm.ExecuteReader();
if (reader.Read())
{
i = reader.GetInt32(0);
}
Response.Write(i.ToString());
}
catch (Exception ee)
{
Response.Write(ee.ToString());
}
}
}
这是PID字段的详细介绍 展开
System.InvalidCastException: 指定的转换无效。
这是网页代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.OleDb;
public partial class t : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Int32 i = 0;
try
{
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.Web.HttpContext.Current.Server.MapPath("~/") + "pic.mdb");
conn.Open();
OleDbCommand comm = new OleDbCommand("select max(PID) from ima", conn);
OleDbDataReader reader = comm.ExecuteReader();
if (reader.Read())
{
i = reader.GetInt32(0);
}
Response.Write(i.ToString());
}
catch (Exception ee)
{
Response.Write(ee.ToString());
}
}
}
这是PID字段的详细介绍 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询