为什么不能写入数据库?小弟初学望各位大侠赐教,急

pinkroad 2008-01-02 02:05:00
学着改程序可是t_bargain表里的b_jbr,b_zg,b_img为什么老写不进去数据

程序太长不给贴,传了个附件,请大侠们看看
...全文
183 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
zmaini1420 2008-01-04
  • 打赏
  • 举报
回复
UP!!~~~~免得沉了!~~
zmaini1420 2008-01-04
  • 打赏
  • 举报
回复
UP!!~~~~免得沉了!~~
pinkroad 2008-01-03
  • 打赏
  • 举报
回复
问题已解决,谢谢大家
pinkroad 2008-01-02
  • 打赏
  • 举报
回复
http://sinro.cn/temp/aaa.rar

又改了一下还是不能写进b_jbr,b_zg,b_img
mezzi100 2008-01-02
  • 打赏
  • 举报
回复
MM_editCmd.CommandText = MM_editQuery
response.write MM_editQuery
response.end
你的更新语句有问题,在112行左右写如上语句。

然后把屏幕上打印出来的sql语句放到access的查询里执行看看。
mezzi100 2008-01-02
  • 打赏
  • 举报
回复
大概调试了一下。
错误很多:
1、字段名称b_gz你写错了,应该是b_zg
2、字段b_aname字段的输入不能为空
3、字段 't_bargain.b_num' 不能是零长度的字符串
...

下面没有继续调试了,偶不会用dreamweaver调用asp动态数据这个功能。
另外你给的附件需要去掉
<!--#include file="chk_login.asp" -->
<!--#include file="chk_level3.asp" -->
这两行才可以运行,并且运行地址为 http://localhost/b_updata.asp?b_id=11
yanniu008 2008-01-02
  • 打赏
  • 举报
回复
是的 做为新手来说要学会打印(response.write)
在适当的位置打印 看一下参数或者语法有没有错误 这是很重要的
homel 2008-01-02
  • 打赏
  • 举报
回复
你所贴出来的代码都是dw里面自动生成的,不是很好看..
以下为调试方法:
1.首先将传递过来的参数写出来,即就是response.write 你的参数
2.确定传递的参数值是否是你输入的..
3.把你写的sql也response.write 出来....
pinkroad 2008-01-02
  • 打赏
  • 举报
回复
新传个了附件,请各位再帮忙看看,谢谢

www.sinro.cn/temp/asperr.rar
pinkroad 2008-01-02
  • 打赏
  • 举报
回复
无法显示网页
试图访问的网页出现问题,无法显示。

--------------------------------------------------------------------------------

请尝试执行下列操作:

单击刷新按钮,或稍后重试。

打开 192.168.0.27 主页,然后查找与所需信息相关的链接。
HTTP 错误 500.100 - 内部服务器错误 - ASP 错误
Internet 信息服务

--------------------------------------------------------------------------------

技术信息(用于支持人员)

错误类型:
Microsoft JET Database Engine (0x80040E10)
至少一个参数没有被指定值。
/b_updata.asp, 第 112 行


浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

网页:
POST 171 ??? /b_updata.asp

POST Data:
b_tid=1&b_jbr=&b_zg=&b_name=222&b_company=333&b_date=10%2F01%2F2008&b_datediff=2&b_money=444&b_sign=%D2%D1%C7%A9%D4%BC&b_img=&b_content=dfsd&MM_update=form1&MM_recordId=23

时间:
2008年1月2日, 13:58:32


详细信息:
Microsoft 支持



这是运行出错的页面
pinkroad 2008-01-02
  • 打赏
  • 举报
回复
整个大概有2M大小附件给传这么大么?!好人真多啊5555555555555
yangtzeu 2008-01-02
  • 打赏
  • 举报
回复
给文件夹相应的读写权限,可能是权限不够
pinkroad 2008-01-02
  • 打赏
  • 举报
回复
Set rsbt = Server.CreateObject("ADODB.Recordset")
rsbt.ActiveConnection = MM_conn_bargain_STRING
rsbt.Source = "SELECT * FROM t_btype"
rsbt.CursorType = 0
rsbt.CursorLocation = 2
rsbt.LockType = 1
rsbt.Open()

rsbt_numRows = 0
%>
<%
Dim rsb__MMColParam
rsb__MMColParam = "1"
If (Request.QueryString("b_id") <> "") Then
rsb__MMColParam = Request.QueryString("b_id")
End If
%>
<%
Dim rsb
Dim rsb_numRows

Set rsb = Server.CreateObject("ADODB.Recordset")
rsb.ActiveConnection = MM_conn_bargain_STRING
rsb.Source = "SELECT * FROM t_bargain WHERE b_id = " + Replace(rsb__MMColParam, "'", "''") + ""
rsb.CursorType = 0
rsb.CursorLocation = 2
rsb.LockType = 1
rsb.Open()

rsb_numRows = 0
%>
<%
If rsbt.EOF And rsbt.BOF Then
response.Write("请先添加企业类别")
response.end
end if
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Config/style.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" media="all" href="Config/calendar-win2k-1.css" title="win2k-1" />
<script type="text/javascript" src="Config/calendar.js"></script>
<script type="text/javascript" src="lang/calendar-en.js"></script>
<script type="text/javascript">
<!--
var oldLink = null;
// code to change the active stylesheet
function setActiveStyleSheet(link, title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
if (oldLink) oldLink.style.fontWeight = 'normal';
oldLink = link;
link.style.fontWeight = 'bold';
return false;
}

// This function gets called when the end-user clicks on some date.
function selected(cal, date) {
cal.sel.value = date; // just update the date in the input field.
if (cal.sel.id == "sel1" || cal.sel.id == "sel3")
// if we add this call we close the calendar on single-click.
// just to exemplify both cases, we are using this only for the 1st
// and the 3rd field, while 2nd and 4th will still require double-click.
cal.callCloseHandler();
}

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks on the "Close" button. It just hides the calendar without
// destroying it.
function closeHandler(cal) {
cal.hide(); // hide the calendar
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id, format) {
var el = document.getElementById(id);
if (calendar != null) {
// we already have some calendar created
calendar.hide(); // so we hide it first.
} else {
// first-time call, create the calendar.
var cal = new Calendar(false, null, selected, closeHandler);
// uncomment the following line to hide the week numbers
// cal.weekNumbers = false;
calendar = cal; // remember it in the global var
cal.setRange(1900, 2070); // min/max year allowed.
cal.create();
}
calendar.setDateFormat(format); // set the specified date format
calendar.parseDate(el.value); // try to parse the text in field
calendar.sel = el; // inform it what input field we use
calendar.showAtElement(el); // show the calendar below it

return false;
}

var MINUTE = 60 * 1000;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var WEEK = 7 * DAY;

// If this handler returns true then the "date" given as
// parameter will be disabled. In this example we enable
// only days within a range of 10 days from the current
// date.
// You can use the functions date.getFullYear() -- returns the year
// as 4 digit number, date.getMonth() -- returns the month as 0..11,
// and date.getDate() -- returns the date of the month as 1..31, to
// make heavy calculations here. However, beware that this function
// should be very fast, as it is called for each day in a month when
// the calendar is (re)constructed.
function isDisabled(date) {
var today = new Date();
return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
}

function flatSelected(cal, date) {
var el = document.getElementById("preview");
el.innerHTML = date;
}

function showFlatCalendar() {
var parent = document.getElementById("display");

// construct a calendar giving only the "selected" handler.
var cal = new Calendar(false, null, flatSelected);

// hide week numbers
cal.weekNumbers = false;

// We want some dates to be disabled; see function isDisabled above
cal.setDisabledHandler(isDisabled);
cal.setDateFormat("DD, M d");

// this call must be the last as it might use data initialized above; if
// we specify a parent, as opposite to the "showCalendar" function above,
// then we create a flat calendar -- not popup. Hidden, though, but...
cal.create(parent);

// ... we can show it here.
cal.show();
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
pinkroad 2008-01-02
  • 打赏
  • 举报
回复
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables

If (CStr(Request("MM_update")) = "form1" And CStr(Request("MM_recordId")) <> "") Then

MM_editConnection = MM_conn_bargain_STRING
MM_editTable = "t_bargain"
MM_editColumn = "b_id"
MM_recordId = "" + Request.Form("MM_recordId") + ""
MM_editRedirectUrl = "bargain.asp"
MM_fieldsStr = "b_tid|value|b_num|value|b_name|value|b_company|value|b_date|value|b_datediff|value|b_money|value|b_sign|value|b_check|value|b_aname|value|b_content|value|b_jbr|value|b_gz|value|b_img|value"
MM_columnsStr = "b_tid|none,none,NULL|b_num|',none,''|b_name|',none,''|b_company|',none,''|b_date|',none,''|b_datediff|none,none,NULL|b_money|',none,''|b_sign|',none,''|b_check|',none,''|b_aname|',none,''|b_content|',none,''|b_jbr|',none,''|b_gz|',none,''|b_img|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If

End If
%>
<%
' *** Update Record: construct a sql update statement and execute it

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

' create the sql update statement
MM_editQuery = "update " & MM_editTable & " set "
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & ","
End If
MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
Next
MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId

If (Not MM_abortEdit) Then
' execute the update
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>
<%
Dim rsbt
Dim rsbt_numRows
fcuandy 2008-01-02
  • 打赏
  • 举报
回复
你自己在ie>选项>高级>去掉http友好错误显示前面的钩. 运行一下,说哪行报错.

你这代码不好看.
heshengfen123 2008-01-02
  • 打赏
  • 举报
回复
代码给我的不全,把相关的也拿上来吧
gingerkang 2008-01-02
  • 打赏
  • 举报
回复
语句错了就贴语句,程序错了就贴出错误的地方和提示,发了文件没有环境也很难测试的

里面只有看到update,没有看到insert或.update之类的字符,应该没有插入操作,只有更新操作,你是问数据不能更新吗?
贴出对应的MM_editQuery看看语句有什么问题.

28,404

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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