|
 |
access_asp thread: adding data to access,problem!! help!!
Message #1 by "leorio" <blue_dl@s...> on Fri, 16 Aug 2002 15:00:11
|
|
i want to add data to my table in database of gameintro.mdb,but it doesn't
work,and the problem is:
VBscript run-time error(0x800A01B6)
here is my code:
~~~~~~~~~~~~~~~~~~~~~~
<%
str="d:\my\data\gameintro.mdb"
strcon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&str
set connect=Server.CreateObject("ADODB.Connection")
connect.Open strcon
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "pi",strcon, 2, 2
subject=request("subject")
account=request("account")
text=request("text")
sql="insert into pi(name,subject,text) values <<--maybe here
('"&account&"','"&subject&"','"&text&"')"
rs.Execute(sql)
rs.Close
connect.Close
%>
Message #2 by "Daniel Groh" <daniel.groh@s...> on Fri, 16 Aug 2002 10:50:51 -0300
|
|
Are u adding with mm/dd/aaaa or dd/mm/aaaa ?
The type of field is Smalldatetime ? Look there...
insert into table(data_filed,text_field)
values(#"&datevar&"#,'"&textvar&"')...
look the #, it is for date type...
Cya
----- Original Message -----
From: leorio <blue_dl@s...>
To: Access ASP <access_asp@p...>
Sent: Friday, August 16, 2002 3:00 PM
Subject: [access_asp] adding data to access,problem!! help!!
> i want to add data to my table in database of gameintro.mdb,but it doesn't
> work,and the problem is:
>
> VBscript run-time error(0x800A01B6)
>
> here is my code:
> ~~~~~~~~~~~~~~~~~~~~~~
> <%
> str="d:\my\data\gameintro.mdb"
> strcon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&str
> set connect=Server.CreateObject("ADODB.Connection")
> connect.Open strcon
> Set rs = Server.CreateObject("ADODB.Recordset")
> rs.Open "pi",strcon, 2, 2
> subject=request("subject")
> account=request("account")
> text=request("text")
> sql="insert into pi(name,subject,text) values <<--maybe here
> ('"&account&"','"&subject&"','"&text&"')"
> rs.Execute(sql)
> rs.Close
> connect.Close
> %>
>
Message #3 by "Daniel Groh" <daniel.groh@s...> on Fri, 16 Aug 2002 10:58:00 -0300
|
|
str="d:\my\data\gameintro.mdb" 'that is wrong because is a constant, you should to do that:
const str="d:\my\data\gameintro.mdb"
Ok?
Tray again and sorry my last answer
----- Original Message -----
From: leorio <blue_dl@s...>
To: Access ASP <access_asp@p...>
Sent: Friday, August 16, 2002 3:00 PM
Subject: [access_asp] adding data to access,problem!! help!!
> i want to add data to my table in database of gameintro.mdb,but it doesn't
> work,and the problem is:
>
> VBscript run-time error(0x800A01B6)
>
> here is my code:
> ~~~~~~~~~~~~~~~~~~~~~~
> <%
> str="d:\my\data\gameintro.mdb"
> strcon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&str
> set connect=Server.CreateObject("ADODB.Connection")
> connect.Open strcon
> Set rs = Server.CreateObject("ADODB.Recordset")
> rs.Open "pi",strcon, 2, 2
> subject=request("subject")
> account=request("account")
> text=request("text")
> sql="insert into pi(name,subject,text) values <<--maybe here
> ('"&account&"','"&subject&"','"&text&"')"
> rs.Execute(sql)
> rs.Close
> connect.Close
> %>
>
Message #4 by "leorio" <blue_dl@s...> on Fri, 16 Aug 2002 15:16:55
|
|
thanks,but i don't add any datetime-type,the type of all the three
parameters is text.what can i do now?
Message #5 by "leorio" <blue_dl@s...> on Fri, 16 Aug 2002 15:21:16
|
|
problem is still remaining!
Message #6 by "Daniel Groh" <daniel.groh@s...> on Fri, 16 Aug 2002 11:07:11 -0300
|
|
How I said, I was wrong, but I already corrected...
----- Original Message -----
From: leorio <blue_dl@s...>
To: Access ASP <access_asp@p...>
Sent: Friday, August 16, 2002 3:16 PM
Subject: [access_asp] Re: adding data to access,problem!! help!!
> thanks,but i don't add any datetime-type,the type of all the three
> parameters is text.what can i do now?
>
Message #7 by "leorio" <blue_dl@s...> on Fri, 16 Aug 2002 15:25:15
|
|
no,it doesn't work
i think it maybe the sql,which is wrong,but i don't know where it is.
Message #8 by "Daniel Groh" <daniel.groh@s...> on Fri, 16 Aug 2002 11:13:18 -0300
|
|
no, the sql command is correct, can believe...
----- Original Message -----
From: leorio <blue_dl@s...>
To: Access ASP <access_asp@p...>
Sent: Friday, August 16, 2002 3:25 PM
Subject: [access_asp] Re: adding data to access,problem!! help!!
> no,it doesn't work
> i think it maybe the sql,which is wrong,but i don't know where it is.
>
Message #9 by "leorio" <blue_dl@s...> on Fri, 16 Aug 2002 15:31:06
|
|
Message #10 by "Daniel Groh" <daniel.groh@s...> on Fri, 16 Aug 2002 11:19:00 -0300
|
|
sql command to insert:
cmd1 = request.form("A1")
cmd2 = request.form("A2")
cmd3 = request.form("A3")
this command insert just in fields char type
insert = "INSER INTO table (field1,field2,field3) VALUES ('"&cmd1&"','"&cmd2&"','"&cmd3&"')"
----------------------------------------------------------------------------------------------------------------------------------
this command insert just in fields number type
insert = "INSER INTO table (field1,field2,field3) VALUES ("&cmd1&","&cmd2&","&cmd3&")"
if you are inserting number and you are using '"&&"', this is a char type and no a number type
Message #11 by "Daniel Groh" <daniel.groh@s...> on Fri, 16 Aug 2002 11:23:03 -0300
|
|
that's stranger, isn't it?
I didn't find any wrong...
verify if you aren't inserting char in field number
----- Original Message -----
From: leorio <blue_dl@s...>
To: Access ASP <access_asp@p...>
Sent: Friday, August 16, 2002 3:31 PM
Subject: [access_asp] Re: adding data to access,problem!! help!!
> so,what's wrong?
>
Message #12 by "leorio" <blue_dl@s...> on Fri, 16 Aug 2002 15:42:04
|
|
i have checked my code and my database ,
the type is text,no numeric
is this wrong?
Message #13 by "leorio" <blue_dl@s...> on Fri, 16 Aug 2002 15:46:14
|
|
i am beginner and always meet strange things,
i will go mad soon.:)
Message #14 by "Daniel Groh" <daniel.groh@s...> on Fri, 16 Aug 2002 11:35:37 -0300
|
|
Ok Ok, let's to debug
try it:
<%
str="d:\my\data\gameintro.mdb"
strcon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&str
set connect=Server.CreateObject("ADODB.Connection")
connect.Open strcon
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "pi",strcon, 2, 2
subject=request("subject")
account=request("account")
text=request("text")
sql="insert into pi(name,subject,text) values <<--maybe here
('"&account&"','"&subject&"','"&text&"')"
response.end
rs.Execute(sql)
rs.Close
connect.Close
%>
Message #15 by "leorio" <blue_dl@s...> on Fri, 16 Aug 2002 15:59:14
|
|
new problem:
Microsoft JET Database Engine (0x80040E14)
<%
str="d:\my\data\gameintro.mdb"
strcon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&str
set connect=Server.CreateObject("ADODB.Connection")
connect.Open strcon
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "pi",strcon, 2, 2 <<--at here!!!
subject=request("subject")
account=request("account")
text=request("text")
sql="insert into pi(name,subject,text) values
('"&account&"','"&subject&"','"&text&"')"
response.end
rs.Execute(sql)
rs.Close
connect.Close
%>
Message #16 by "leorio" <blue_dl@s...> on Fri, 16 Aug 2002 16:18:57
|
|
again,
VBScript runtime error (0x800A01B6)
oops!
Message #17 by "Daniel Groh" <daniel.groh@s...> on Fri, 16 Aug 2002 12:23:09 -0300
|
|
ok, we are going to right way...
Did you install Microsoft Data Access ?
I think you don't have the driver for JET4.0
----- Original Message -----
From: leorio <blue_dl@s...>
To: Access ASP <access_asp@p...>
Sent: Friday, August 16, 2002 3:59 PM
Subject: [access_asp] Re: adding data to access,problem!! help!!
> new problem:
> Microsoft JET Database Engine (0x80040E14)
>
> <%
> str="d:\my\data\gameintro.mdb"
> strcon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&str
> set connect=Server.CreateObject("ADODB.Connection")
> connect.Open strcon
> Set rs = Server.CreateObject("ADODB.Recordset")
> rs.Open "pi",strcon, 2, 2 <<--at here!!!
> subject=request("subject")
> account=request("account")
> text=request("text")
> sql="insert into pi(name,subject,text) values
> ('"&account&"','"&subject&"','"&text&"')"
> response.end
> rs.Execute(sql)
> rs.Close
> connect.Close
> %>
>
>
Message #18 by "Daniel Groh" <daniel.groh@s...> on Fri, 16 Aug 2002 12:26:42 -0300
|
|
try it:
<%
str="d:\my\data\gameintro.mdb"
strcon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&str
set connect=Server.CreateObject("ADODB.Connection")
connect.Open strcon
query = "SELECT * FROM pi"
Set rs = connection.execute(query)
subject=request("subject")
account=request("account")
text=request("text")
sql="insert into pi(name,subject,text) values
('"&account&"','"&subject&"','"&text&"')"
response.write sql
'rs.Execute(sql)
rs.Close
connect.Close
%>
Message #19 by "leorio" <blue_dl@s...> on Fri, 16 Aug 2002 16:53:22
|
|
Message #20 by "leorio" <blue_dl@s...> on Fri, 16 Aug 2002 17:00:41
|
|
no use,still the same
but i find some interesting,let's back to the beginning
if i delete the sentence "rs.execute(sql)" ,the page works,but the
database is not change.then i run the sentence-----problem found
so i think maybe the bug is here? what do you think?
Message #21 by "leorio" <blue_dl@s...> on Fri, 16 Aug 2002 17:09:38
|
|
please look at my another program, it works well!!
it may pove i have Microsoft Data Access
~~~~~~~~~~~~~~~~~~~~~~~
<%
str="d:\my\data\gameintro.mdb"
strcon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&str
set connect=Server.CreateObject("ADODB.Connection")
connect.Open strcon
sql="select * from pi"
Set rs = connect.Execute(sql)
%>
................
<table width="973" border="1" cellspacing="0" cellpadding="0" height="24"
align="center" bordercolor="#000000" bgcolor="#FF6600">
<tr>
<td width="50" height="25">
<div align="center"><font color="#FFFFFF"><b>state</b></font></div>
</td>
<td width="479" height="25">
<div align="center"><b><font color="#FFFFFF">subject</font></b></div>
</td>
<td width="89" height="25">
<div align="center"><font color="#FFFFFF"><b>auther</b></font></div>
</td>
<td width="61" height="25">
<div align="center"><font color="#FFFFFF"><b></b></font></div>
</td>
<td height="25" width="61">
<div align="center"><b><font color="#FFFFFF"></font></b></div>
</td>
<td width="117" height="25">
<div align="center"><font
color="#FFFFFF"><b>lastupdate</b></font></div>
</td>
<td width="70" height="25">
<div align="center"><font color="#FFFFFF"><b></b></font></div>
</td>
<td width="44" height="25">
<div align="center"><font color="#FFFFFF"><b></b></font></div>
</td>
</tr>
<%
Do While Not rs.EOF
%>
<tr class=table>
<td></td>
<td><A href=detail.asp?pi_id=<%=rs("pi_id")%>><%=rs("subject")%></A></td>
<td><%=rs("name")%></td>
<td><%=rs("number")%></td>
<td></td>
<td><%=rs("date")%></td>
<td></td>
<td></td>
</tr>
<%
rs.movenext
Loop
rs.close
Set rs = Nothing
connect.close
Set connect = Nothing
%>
</table>
..............
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #22 by "leorio" <blue_dl@s...> on Fri, 16 Aug 2002 17:58:49
|
|
hei,i think i find the way
but it's strange ,sometimes works well,sometimes bad
here i post it:
~~~~~~~
<%
const str="d:\dingli\my\data\gameintro.mdb"
strcon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&str
set connect=Server.CreateObject("ADODB.Connection")
connect.Open strcon
Set rs = Server.CreateObject("ADODB.Recordset")
with rs
.Open "se",strcon,2,2
.AddNew
.Fields("name")="fdsgfdgfgfdsf"
.Fields("subject")="fdsfggfdffdsf"
.Fields("text")="fdsfdfgfgdsf"
rs.Update
end with
rs.Close
connect.Close
%>
~~~~~~~~~~~~~~~~
Message #23 by "leorio" <blue_dl@s...> on Fri, 16 Aug 2002 18:01:32
|
|
sorry,
here is the correct: :p
~~~
<%
subject=request("subject")
account=request("account")
text=request("text")
const str="d:\dingli\my\data\gameintro.mdb"
strcon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&str
set connect=Server.CreateObject("ADODB.Connection")
connect.Open strcon
Set rs = Server.CreateObject("ADODB.Recordset")
with rs
.Open "pi",strcon,2,2
.AddNew
.Fields("name")="&name&"
.Fields("subject")="&subject&"
.Fields("text")="&text&"
.Update
end with
rs.Close
connect.Close
%>
Message #24 by Abdul Sami <abdul_sami_20@y...> on Fri, 16 Aug 2002 10:08:31 -0700 (PDT)
|
|
DO NOT TELL THE WHOLE STORIES TO EVERYONE. NO ONE IS INTERESTED IN ALL THESE RUBBISH EMAILS.
OK
leorio wrote:again,
VBScript runtime error (0x800A01B6)
oops!
Abdul Sami
---------------------------------
Do You Yahoo!?
HotJobs, a Yahoo! service - Search Thousands of New Jobs
|
|
 |