|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
string Truncated errorstrSql is executed ( my_conn.Execute (strSql) ), but it doesnt happen all the time, just periodically. I used to have this pointing to an Access db, but I changed it over to Sql, getting rid of the # datetime delimiters and replacing with ' . Wondering if the first StrSql string in the if statement if too long: ''''''''''''''''''''''''''' Function ChkString(string) if string = "" then string = " " ChkString = Replace(string, "'", "''") End Function set my_conn= Server.CreateObject("ADODB.Connection") my_Conn.Open DBCon ' Check to see if it's a new record to be added or an old one to update StrSql= "Select * from diary where dte = '" & Request("view_Date") & "'" set rs = my_conn.Execute (StrSql) if rs.BOF or rs.EOF then ' No records found. i.e. New record StrSql ="INSERT INTO diary (dte, text_field) values ('" & request("view_date") & "', '" & chkString(request("txt")) & "')" else ' Record found. i.e. update record. StrSql = "UPDATE diary SET diary.dte = '" & request("view_date") & "', text_field = '" & chkString(request("txt")) & "' WHERE id = " & rs("id") End If my_conn.Execute (strSql) ''''''''''' thanks chumley Well, what is the table definition (e.g. datatype and length of
"text_field" - which is an awful, awful name for a column, by the way)? Show quoteHide quote "Chumley Walrus" <spring***@yahoo.com> wrote in message news:1111517588.706841.242270@z14g2000cwz.googlegroups.com... > I'm getting a "string could be truncated" error at the line where my > strSql is executed ( my_conn.Execute (strSql) ), but it doesnt happen > all the time, just periodically. I used to have this pointing to an > Access db, but I changed it over to Sql, getting rid of the # datetime > delimiters and replacing with ' . Wondering if the first StrSql string > in the if statement if too long: > > ''''''''''''''''''''''''''' > Function ChkString(string) > if string = "" then string = " " > ChkString = Replace(string, "'", "''") > End Function > > set my_conn= Server.CreateObject("ADODB.Connection") > my_Conn.Open DBCon > > ' Check to see if it's a new record to be added or an old one to > update > StrSql= "Select * from diary where dte = '" & Request("view_Date") & > "'" > set rs = my_conn.Execute (StrSql) > > if rs.BOF or rs.EOF then ' No records found. i.e. New record > StrSql ="INSERT INTO diary (dte, text_field) values ('" & > request("view_date") & "', '" & chkString(request("txt")) & "')" > else ' Record found. i.e. update record. > StrSql = "UPDATE diary SET diary.dte = '" & request("view_date") & "', > text_field = '" & chkString(request("txt")) & "' WHERE id = " & > rs("id") > End If > > my_conn.Execute (strSql) > > ''''''''''' > > thanks > chumley > Chumley Walrus wrote:
> I'm getting a "string could be truncated" error at the line where my Are you using POST or GET for your form method? Using request("txt") is> strSql is executed ( my_conn.Execute (strSql) ), but it doesnt happen > all the time, just periodically... ambiguous. Show quoteHide quote > ...StrSql ="INSERT INTO diary (dte, text_field) values ('" & > request("view_date") & "', '" & chkString(request("txt"))... -- Dave Anderson Unsolicited commercial email will be read at a cost of $500 per message. Use of this email address implies consent to these terms. Please do not contact me directly or ask me to contact you directly for assistance. If your question is worth asking, it's worth posting. Hi,
This error happens when the data that you try to update or insert in the table is more than what the field can handle. For ex: a varchar(20) string cannot hold more than 20 characters. So you will get the error when you pass a string to this field which is more than 20. Ganesh Show quoteHide quote "Chumley Walrus" wrote: > I'm getting a "string could be truncated" error at the line where my > strSql is executed ( my_conn.Execute (strSql) ), but it doesnt happen > all the time, just periodically. I used to have this pointing to an > Access db, but I changed it over to Sql, getting rid of the # datetime > delimiters and replacing with ' . Wondering if the first StrSql string > in the if statement if too long: > > ''''''''''''''''''''''''''' > Function ChkString(string) > if string = "" then string = " " > ChkString = Replace(string, "'", "''") > End Function > > set my_conn= Server.CreateObject("ADODB.Connection") > my_Conn.Open DBCon > > ' Check to see if it's a new record to be added or an old one to > update > StrSql= "Select * from diary where dte = '" & Request("view_Date") & > "'" > set rs = my_conn.Execute (StrSql) > > if rs.BOF or rs.EOF then ' No records found. i.e. New record > StrSql ="INSERT INTO diary (dte, text_field) values ('" & > request("view_date") & "', '" & chkString(request("txt")) & "')" > else ' Record found. i.e. update record. > StrSql = "UPDATE diary SET diary.dte = '" & request("view_date") & "', > text_field = '" & chkString(request("txt")) & "' WHERE id = " & > rs("id") > End If > > my_conn.Execute (strSql) > > ''''''''''' > > thanks > chumley > >
Can a web user can be logged on as an account other than IUSR_?
IIS6 & ASP: accessing network files with FSO fails Call php/mysql database from ASP sql problem with sub queries Trapping odbc error when exec'ing INSERT command Checking for duplication in an array or delimited string SSL/Response Object/data to client Sending Mail Using ASP/VBScript to Exchange Mail Box How to use different sites in IIS on WinXP Pro xslisapi download |
|||||||||||||||||||||||