~~~~~~~神都解决不了的问题

蜗牛水里爬 2007-06-28 10:02:30
服务器块的格式不正确
错误文件为App_Data\DataBase.aspx
DataBase.aspx文件是ACCESS数据库

如上问题怎么解决
挂上IIS网站可以正常运行
但是这个该死的问题怎么弄啊
...全文
210 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
逍遥的窝头 2007-07-23
  • 打赏
  • 举报
回复
DataBase.aspx文件是ACCESS数据库

这2个没什么联系吧....晕
  • 打赏
  • 举报
回复
改成.config或者.cs。直接和平时链接数据库一样的方式打开,可以的
blackhero 2007-07-23
  • 打赏
  • 举报
回复
DataBase.aspx文件是ACCESS数据库

???"
honey52570 2007-07-23
  • 打赏
  • 举报
回复
aspx的照样把你下下来
xjumm 2007-07-23
  • 打赏
  • 举报
回复
ACCESS数据库数据库可能和VS.NET不兼容
你的代码块里面有OPEN的地方
出现异常了你没有关闭
加个TRY就好了,(然后在重新更换数据库
或者直接把数据库的后缀名改成ACCESS默认的)
蜗牛水里爬 2007-06-28
  • 打赏
  • 举报
回复
改成ASPX的后缀可以防止下载数据库
windily 2007-06-28
  • 打赏
  • 举报
回复
DataBase.aspx文件是ACCESS数据库?
此话何解
可爱的排骨 2007-06-28
  • 打赏
  • 举报
回复
贴下小黄页
蜗牛水里爬 2007-06-28
  • 打赏
  • 举报
回复
这个代码也是报一样的错误
<%@ Page Language="C#" EnableViewState="true" %>

<%@ Import Namespace="System.Data.OleDb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Button1_Click( object sender, EventArgs e )
{
System.IO.Stream fileDataStream = FileUpload1.PostedFile.InputStream;

if (fileDataStream.Length < 1)
{
Msg.Text = "请选择文件。";
return;
}

//得到文件大小
int fileLength = FileUpload1.PostedFile.ContentLength;

//创建数组
byte[] fileData = new byte[fileLength];
//把文件流填充到数组
fileDataStream.Read(fileData, 0, fileLength);
//得到文件类型
string fileType = FileUpload1.PostedFile.ContentType;

//构建数据库连接,SQL语句,创建参数
string strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("Image2Access.mdb");
OleDbConnection myConnection = new OleDbConnection(strCnn);
OleDbCommand command = new OleDbCommand("INSERT INTO Person (PersonName,PersonEmail,PersonSex,PersonImageType,PersonImage)" +
"VALUES (@PersonName,@PersonEmail,@PersonSex,@PersonImageType,@PersonImage)", myConnection);

command.Parameters.AddWithValue("@PersonName",TextBox1.Text);
command.Parameters.AddWithValue("@PersonEmail", "mengxianhui@dotnet.aspx.cc");
command.Parameters.AddWithValue("@paramPersonSex", "男");
command.Parameters.AddWithValue("@PersonImageType", fileType);
command.Parameters.AddWithValue("@PersonImage", fileData);


//打开连接,执行查询
myConnection.Open();
command.ExecuteNonQuery();
myConnection.Close();
Response.Redirect(Request.RawUrl);
}


protected void Page_Load( object sender, EventArgs e )
{

if (!Page.IsPostBack)
{
BindGrid();
}
}

private void BindGrid( )
{
string strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
+ Server.MapPath("Image2Access.mdb");
OleDbConnection myConnection = new OleDbConnection(strCnn);
OleDbCommand myCommand = new OleDbCommand("SELECT * FROM Person", myConnection);

try
{
myConnection.Open();
GridView1.DataSource = myCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
GridView1.DataBind();
}
catch (OleDbException SQLexc)
{
Response.Write("提取数据时出现错误:" + SQLexc.ToString());
}
}
protected string FormatURL( object strArgument )
{
return "ReadImage.aspx?id=" + strArgument.ToString();
}

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>上传文件到数据库</title>
</head>
<body>
<form id="MengXianhui" runat="server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<%#Eval("PersonName") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<%#Eval("PersonEmail") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<%#Eval("PersonSex") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<img src="<%#FormatURL(Eval("PersonID")) %>" /></ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<br />
姓名:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
照片:<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="btnUpload" runat="server" Text="上传" OnClick="Button1_Click"></asp:Button>
<p>
<asp:Label ID="Msg" runat="server" ForeColor="Red"></asp:Label></p>
</form>
</body>
</html>
蜗牛水里爬 2007-06-28
  • 打赏
  • 举报
回复
狂晕  啊是不是我的系统有问题啊
我的项目是原来机器上拿过来的
蜗牛水里爬 2007-06-28
  • 打赏
  • 举报
回复
就是显示
服务器块的格式不正确
winner2050 2007-06-28
  • 打赏
  • 举报
回复
说什么啊。

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧