Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

i need help..... i face problem

Status
Not open for further replies.

broloc

Programmer
Jun 10, 2002
27
JP
i need help.....

i face problem when i want to update my mark obtained and comment data from this interface..if i key in data in mark obtained text field in first line of retrived data from database but by default system insert the same value for the other line..means in te database it contain the same value eventhough i never key in for the rest of textfield..
and if i key in data in whole textfield for the mark obtained and i get the msg "Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E57)
String or binary data would be truncated."

here i paste down my coding..
1) the coding from the post interface
<table width=&quot;100%&quot; border=&quot;0&quot;>
<tr>
<td width=&quot;17%&quot;>Matric Number</td>
<td width=&quot;11%&quot;>Student Name</td>
<td width=&quot;14%&quot;>Assignment File</td>
<td width=&quot;10%&quot;><span id=&quot;spUpload&quot; name=&quot;spupload&quot; style=&quot;display:none&quot;>Posted
On</span></td>
<td width=&quot;13%&quot;>Mark Obtained</td>
<td width=&quot;35%&quot;>Comment</td>
<% While not rsTugasan.eof %>
</tr>
<tr>
<td width=&quot;17%&quot;><%= rsTugasan (&quot;MatricNumber&quot;) %>
<input type=&quot;text&quot; name=&quot;NoMatrik&quot; value=&quot;<%=rsTugasan(&quot;MatricNumber&quot;)%>&quot;>
</td>
<td width=&quot;11%&quot;><%=rsTugasan(&quot;NamaPel&quot;)%></td>
<td width=&quot;14%&quot;><%= rsTugasan(&quot;NamaFail&quot;)%></td>
<td width=&quot;10%&quot;><%= rsTugasan(&quot;TarikhHantar&quot;)%></td>

<td width=&quot;13%&quot;>
<input type=&quot;text&quot; name=&quot;Markah2&quot; size=&quot;5&quot; >
</td>
<td width=&quot;35%&quot;>
<textarea name=&quot;textarea&quot; cols=&quot;-3&quot; style=&quot;width:220px;height:50px&quot; >
</textarea>
<% rsTugasan.movenext
wend
rsTugasan.movefirst
%>
</td>
</tr>
<tr>
<td width=&quot;17%&quot;><%=b%></td>
<td width=&quot;11%&quot;> </td>
<td width=&quot;14%&quot;>
<input type=&quot;hidden&quot; name=&quot;Markah&quot; value=&quot;<%=b%>&quot; >
</td>
<td width=&quot;10%&quot;> </td>
<td width=&quot;13%&quot;> </td>

<td width=&quot;35%&quot;>
<input type=&quot;submit&quot; name=&quot;Submit2&quot; value=&quot;Update&quot;>
</td>
</tr>
</table>

2) coding of request form
<%
session(&quot;AsgnCode&quot;)=request.form(&quot;Markah&quot;)
b=session(&quot;AsgnCode&quot;)
response.write b
NoMatrik=request.form(&quot;NoMatrik&quot;)

response.write NoMatrik
markah = request.form(&quot;Markah2&quot;)
SQL= &quot;UPDATE Tugasan SET &quot;
SQL = SQL + &quot;Markah='&quot; & markah & &quot;'&quot;
SQL = SQL + &quot;where AsgnCode='&quot;& b &&quot;' &quot;

set RS=objConn.Execute(SQL)
objConn.close
set objConn=Nothing
%>

thanks...


























 
Not sure if its the problem you are having.. but it does look like there is no space before where..

SQL = SQL + &quot;Markah='&quot; & markah & &quot;'&quot;
SQL = SQL + &quot;where AsgnCode='&quot;& b &&quot;' &quot;



www.vzio.com
ASP WEB DEVELOPMENT



 
what do u mean by :
Not sure if its the problem you are having.. but it does look like there is no space before where..

SQL = SQL + &quot;Markah='&quot; & markah & &quot;'&quot;
SQL = SQL + &quot;where AsgnCode='&quot;& b &&quot;' &quot;

please explain more detail..tq :)
 
Instead of this...

SQL= &quot;UPDATE Tugasan SET &quot;
SQL = SQL + &quot;Markah='&quot; & markah & &quot;'&quot;
SQL = SQL + &quot;where AsgnCode='&quot;& b &&quot;' &quot;

---------------------------------------
try this:

SQL= &quot;UPDATE Tugasan SET &quot;
SQL = SQL + &quot;Markah='&quot; & markah & &quot;'&quot;
SQL = SQL + &quot; where AsgnCode='&quot;& b &&quot;' &quot; www.vzio.com
ASP WEB DEVELOPMENT



 
it's not about the spaces,

you have to change the length of the field in the database,

eg varchar(50) if you put in 51 characters the error above will be shown.

increase the field to maximum (255) or change the datatype to memo ( access) or text ( sql server)

 

what do you mean by this coding.. because i didn't see any different of this coding... could you explain more..


Instead of this...

SQL= &quot;UPDATE Tugasan SET &quot;
SQL = SQL + &quot;Markah='&quot; & markah & &quot;'&quot;
SQL = SQL + &quot;where AsgnCode='&quot;& b &&quot;' &quot;

---------------------------------------
try this:

SQL= &quot;UPDATE Tugasan SET &quot;
SQL = SQL + &quot;Markah='&quot; & markah & &quot;'&quot;
SQL = SQL + &quot; where AsgnCode='&quot;& b &&quot;' &quot;
 
snowboardr is saying there is a space in front of the word WHERE.

however, i would agree with nicklieb that you are sticking more stuff in the field than it can handle.

maybe try this:

x = 50 'Change 50 with the size of the field.

SQL= &quot;UPDATE Tugasan SET &quot;
SQL = SQL + &quot;Markah='&quot; & markah & &quot;'&quot;
SQL = SQL + &quot; where AsgnCode='&quot;& Mid(b,1,x) &&quot;' &quot;


Kris
 
sorry, I think the mid should go on the other varaible

SQL= &quot;UPDATE Tugasan SET &quot;
SQL = SQL + &quot;Markah='&quot; & Mid(markah,1,x) & &quot;'&quot;
SQL = SQL + &quot; where AsgnCode='&quot;& b &&quot;' &quot;

Kris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top