newline in Access db....

asp page writes to a "memo" field in access.

if the form contains:

line1
line2
line3

when i submit the page, only "line1" is written to the DB.

anyone know how i fix this?
Jimmy [ Fr, 08 September 2006 17:36 ] [ ID #1459795 ]

Re: newline in Access db....

D'oh!

row height!!!

"Jimmy" <j [at] j.j> wrote in message
news:OCtXAy10GHA.4016 [at] TK2MSFTNGP02.phx.gbl...
> asp page writes to a "memo" field in access.
>
> if the form contains:
>
> line1
> line2
> line3
>
> when i submit the page, only "line1" is written to the DB.
>
> anyone know how i fix this?
>
>
Jimmy [ Fr, 08 September 2006 17:42 ] [ ID #1459796 ]

Re: newline in Access db....

"Jimmy" <j [at] j.j> wrote in message
news:OCtXAy10GHA.4016 [at] TK2MSFTNGP02.phx.gbl...
> asp page writes to a "memo" field in access.
>
> if the form contains:
>
> line1
> line2
> line3
>
> when i submit the page, only "line1" is written to the DB.
>
> anyone know how i fix this?

Show us your code after you strip it down to the fewest
number of lines that can replicate the problem.
McKirahan [ Fr, 08 September 2006 17:45 ] [ ID #1459797 ]

Re: newline in Access db....

Jimmy wrote:
> asp page writes to a "memo" field in access.
>
> if the form contains:
>
> line1
> line2
> line3
>
> when i submit the page, only "line1" is written to the DB.
>
> anyone know how i fix this?
Hard to say without seeing your code, but this works for me:

<%
dim cn,cmd,sql,ar, s, rs
sql="Insert INTO MYTABLE(ID,memofield) VALUES(?,?)"
if Request.Form.Count>0 then
ar=array(10,Request.Form("txtMemo"))
set cn=CreateObject("ADODB.Connection")
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & server.MapPath("xxxxxxxxx.mdb")
set cmd=CreateObject("ADODB.Command")
cmd.CommandText=sql
cmd.CommandType=1 'adCmdText
set cmd.ActiveConnection=cn
on error resume next
cmd.Execute ,ar,128 'adExecuteNoRecords
if err<>0 then
Response.Write "Error upon insert:<BR>" & _
Err.Description
Else
s=""
sql = "select memofield from mytable where id=10"
Err.Clear
set rs=cn.Execute(sql,,1)
if err<>0 then
Response.Write "Error upon retrieval:<BR>" & _
Err.Description
Else
if not rs.eof then s="Data from db" & vbcrlf & rs(0)
end if
end if
rs.close:set rs=nothing
set cmd=nothing
cn.Close:set cn=nothing
end if
%>
<HTML>
<BODY>
<FORM action="" method=POST id=form1 name=form1>
<TEXTAREA rows=6 cols id=textarea1 name=txtMemo>
<%=s%>
</TEXTAREA>
<INPUT type="submit" value="Submit" id=submit1 name=submit1>
</FORM>

</BODY>
</HTML>

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
reb01501 [ Fr, 08 September 2006 18:02 ] [ ID #1459798 ]

Re: newline in Access db....

Exactly. Bear in mind also that when you want to write the memo field
contents back to a web page, you will have to replace the linefeeds -
chr(13) with <br>.

Response.Write Replace(rs("memofield"),chr(13),"<br>")

--
Mike Brind


Jimmy wrote:
> D'oh!
>
> row height!!!
>
> "Jimmy" <j [at] j.j> wrote in message
> news:OCtXAy10GHA.4016 [at] TK2MSFTNGP02.phx.gbl...
> > asp page writes to a "memo" field in access.
> >
> > if the form contains:
> >
> > line1
> > line2
> > line3
> >
> > when i submit the page, only "line1" is written to the DB.
> >
> > anyone know how i fix this?
> >
> >
Mike Brind [ Fr, 08 September 2006 22:33 ] [ ID #1459800 ]

Re: newline in Access db....

thank you. now if you can tell me why this code doesnt work the way the
"guru" here said it should, id really be thankful!
this is "supposed" to pull a random record from the database and display it
more efficiently than how i was doing it:

<%
Dim oConn, oRS, randNum
Randomize()
randNum = (CInt(1000 * Rnd) + 1) * -1
Set oConn=Server.CreateObject("ADODB.Connection")
Set oRS=Server.CreateObject("ADODB.recordset")
oConn.Provider="Microsoft.Jet.OLEDB.4.0"
oConn.Open Server.MapPath("temp.mdb")

oRS.Open "SELECT TOP 1 EMAIL_ADDRESS, r = " & Rnd(randNum) & " FROM TABLE1",
oConn, adOpenStatic, adLockReadOnly

Response.Write oRS("EMAIL_ADDRESS")

oRS.close
oConn.close
Set oConn = nothing
Set oRS = nothing
%>

but i get an error saying a required parameter is missing.
any ideas?



"Mike Brind" <paxtonend [at] hotmail.com> wrote in message
news:1157747596.487248.261440 [at] e3g2000cwe.googlegroups.com...
> Exactly. Bear in mind also that when you want to write the memo field
> contents back to a web page, you will have to replace the linefeeds -
> chr(13) with <br>.
>
> Response.Write Replace(rs("memofield"),chr(13),"<br>")
>
> --
> Mike Brind
>
>
> Jimmy wrote:
>> D'oh!
>>
>> row height!!!
>>
>> "Jimmy" <j [at] j.j> wrote in message
>> news:OCtXAy10GHA.4016 [at] TK2MSFTNGP02.phx.gbl...
>> > asp page writes to a "memo" field in access.
>> >
>> > if the form contains:
>> >
>> > line1
>> > line2
>> > line3
>> >
>> > when i submit the page, only "line1" is written to the DB.
>> >
>> > anyone know how i fix this?
>> >
>> >
>
Jimmy [ Fr, 08 September 2006 22:45 ] [ ID #1459801 ]

Re: newline in Access db....

Mike Brind wrote:
> Exactly. Bear in mind also that when you want to write the memo field
> contents back to a web page, you will have to replace the linefeeds -
> chr(13) with <br>.

Not when using a textarea. See my example code


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
reb01501 [ Fr, 08 September 2006 22:52 ] [ ID #1459802 ]

Re: newline in Access db....

Jimmy wrote:
> thank you. now if you can tell me why this code doesnt work the way
> the "guru"
If you're referring to me, then you've just earned yourself a plonk.
I've spent all afternoon trying to help you with this ... I was in the
middle of debugging the aircode statement I gave you when I saw this
dig.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
reb01501 [ Fr, 08 September 2006 22:54 ] [ ID #1459803 ]

Re: newline in Access db....

Well, you've made two mistakes here.

The first is to take a question from one thread and add it to another.
This makes it hard for anyone prepared to provide assistance to work
out what stage the solution has reached. The issue could get resolved
in this thread, yet other people may continue to work on the problem in
the other thread. That's not clever.

The second mistake is to insult someone who has, IMO, been unbelievably
patient with you up to this point. No one here gets paid to offer help
or advice. Most of the regular posters here have full time jobs, and
use their spare time to comtibute.

--
Mike Brind

Jimmy wrote:
> thank you. now if you can tell me why this code doesnt work the way the
> "guru" here said it should, id really be thankful!
> this is "supposed" to pull a random record from the database and display it
> more efficiently than how i was doing it:
>
> <%
> Dim oConn, oRS, randNum
> Randomize()
> randNum = (CInt(1000 * Rnd) + 1) * -1
> Set oConn=Server.CreateObject("ADODB.Connection")
> Set oRS=Server.CreateObject("ADODB.recordset")
> oConn.Provider="Microsoft.Jet.OLEDB.4.0"
> oConn.Open Server.MapPath("temp.mdb")
>
> oRS.Open "SELECT TOP 1 EMAIL_ADDRESS, r = " & Rnd(randNum) & " FROM TABLE1",
> oConn, adOpenStatic, adLockReadOnly
>
> Response.Write oRS("EMAIL_ADDRESS")
>
> oRS.close
> oConn.close
> Set oConn = nothing
> Set oRS = nothing
> %>
>
> but i get an error saying a required parameter is missing.
> any ideas?
>
>
>
> "Mike Brind" <paxtonend [at] hotmail.com> wrote in message
> news:1157747596.487248.261440 [at] e3g2000cwe.googlegroups.com...
> > Exactly. Bear in mind also that when you want to write the memo field
> > contents back to a web page, you will have to replace the linefeeds -
> > chr(13) with <br>.
> >
> > Response.Write Replace(rs("memofield"),chr(13),"<br>")
> >
> > --
> > Mike Brind
> >
> >
> > Jimmy wrote:
> >> D'oh!
> >>
> >> row height!!!
> >>
> >> "Jimmy" <j [at] j.j> wrote in message
> >> news:OCtXAy10GHA.4016 [at] TK2MSFTNGP02.phx.gbl...
> >> > asp page writes to a "memo" field in access.
> >> >
> >> > if the form contains:
> >> >
> >> > line1
> >> > line2
> >> > line3
> >> >
> >> > when i submit the page, only "line1" is written to the DB.
> >> >
> >> > anyone know how i fix this?
> >> >
> >> >
> >
Mike Brind [ Sa, 09 September 2006 00:17 ] [ ID #1459804 ]

Re: newline in Access db....

Jimmy wrote on Fri, 8 Sep 2006 16:45:07 -0400:

> thank you. now if you can tell me why this code doesnt work the way the
> "guru" here said it should, id really be thankful!
> this is "supposed" to pull a random record from the database and display
> it more efficiently than how i was doing it:
>
> <%
> Dim oConn, oRS, randNum
> Randomize()
> randNum = (CInt(1000 * Rnd) + 1) * -1
> Set oConn=Server.CreateObject("ADODB.Connection")
> Set oRS=Server.CreateObject("ADODB.recordset")
> oConn.Provider="Microsoft.Jet.OLEDB.4.0"
> oConn.Open Server.MapPath("temp.mdb")
>
> oRS.Open "SELECT TOP 1 EMAIL_ADDRESS, r = " & Rnd(randNum) & " FROM
> TABLE1", oConn, adOpenStatic, adLockReadOnly
>
> Response.Write oRS("EMAIL_ADDRESS")
>
> oRS.close
> oConn.close
> Set oConn = nothing
> Set oRS = nothing
> %>
>
> but i get an error saying a required parameter is missing.
> any ideas?

Well after taking a dig at Bob I guess most people won't be inclined to
help. I'll give you a hint, rather than fixing your code - you have a lot to
learn about SQL.

Dan
Daniel Crichton [ Fr, 15 September 2006 16:49 ] [ ID #1467685 ]
Webserver » microsoft.public.inetserver.asp.db » newline in Access db....

Vorheriges Thema: Record Check Error
Nächstes Thema: Error message 80040E57