!急!!!asp.net新闻系统中如何填加数据(有代码)
<MM:DataSet id="zxdt"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_lianjie") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_lianjie") %>'
CommandText='<%# "SELECT zxdtbt, zxdtfbt, zxdtid, zxdtnr, zxdtzz FROM zxdtb WHERE zxdtid = ?" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@zxdtid" Value='<%# IIf((Request.QueryString("zxdtid") <> Nothing), Request.QueryString("zxdtid"), "") %>' Type="WChar" />
</Parameters>
</MM:DataSet>
<MM:DataSet
id="zxdt2"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_lianjie") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_lianjie") %>'
CommandText='<%# "SELECT * FROM zxdtb WHERE zxdtbt = ?" %>'
Debug="true"
>
<Parameters>
<Parameter Name="@zxdtbt" Value='<%# IIf((Request.Form("zxdtbt") <> Nothing), Request.Form("zxdtbt"), "") %>' Type="WChar" />
</Parameters>
</MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<script runat="server">
Sub tj_Click(ByVal sender As Object, ByVal e As System.EventArgs)
dim mycon as oledbconnection
dim connstring as string
connstring="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&server.MapPath("../")&"\db\db.mdb"
mycon=new oledbconnection(connstring)
mycon.open()
if zxdt2.recordcount>0 and zxdtbt.text<>zxdt.FieldValue("zxdtbt",nothing) then
response.Redirect("ybzy.aspx")
else
dim mycommand as oledbcommand
dim mysql as string
mysql="update zxdtb set zxdtid='"+request.Form("zxdtid")+"',zxdtbt='"+request.Form("zxdtbt")+"',zxdtfbt='"+request.Form("zxdtfbt")+"',zxdtzz='"+request.Form("zxdtzz")+"',zxdtnr='"+request.Form("zxdtnr")+"' WHERE zxdtid='"+ Request.QueryString("zxdtid")+"'"
mycommand=new oledbcommand(mysql,mycon)
dim myreader as oledbdatareader
myreader=mycommand.Executereader()
myreader.close()
response.Redirect("zxdtgl.aspx")
end if
end sub
sub sc_click(ByVal sender As Object, ByVal e As System.EventArgs)
dim myupfile as HttpPostedFile=request.files(0)
dim FileSubName() as string=split(myupfile.filename,"\")
dim FileRealName as string=FileSubName(FileSubName.length-1)
myupfile.saveas(server.MapPath("..")&"\upload\"&FileRealName)
dim i
i=FileRealName
sclj.text=""
end sub
</script>
大家帮我看看哪有问题,网站为什么不可以从后台自动添加数据到数据库呢,麻烦告诉小弟,谢谢了。
在线等待达人告诉答案,不胜感激!
[此贴子已经被作者于2007-6-14 15:16:06编辑过]