Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1793
  • Last Modified:

error - The field is too small to accept the amount of data you attempted to add?

this is the error i am getting, code also follows:

 The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data.

Source Error:

Line 13:
Line 14:         cnn.Open()
Line 15:         cmd.ExecuteNonQuery()
Line 16:         cnn.Close()
Line 17:


Source File: C:\wwwroot\connectinglondon\test1.aspx    Line: 15



<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
      <script language="VB" runat="server">
            
       Sub Submit_Click(Sender as Object, e as EventArgs)
               Dim cnn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & server.mappath("cl.mdb"))
        Dim cmd As New OleDb.OleDbCommand
        cmd.CommandText = "INSERT INTO members (title, first_name, last_name) VALUES (' & title.Value  & ', ' & first_name.Value  & ', ' & last_name.Value & ')"
        cmd.Connection = cnn

        cnn.Open()
        cmd.ExecuteNonQuery()
        cnn.Close()

        cmd.Dispose()
        cnn.Dispose()
     
     end sub
      
      </script>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>

 <form runat="server">
 
 <input type="text" id="title" value="Title" runat="server"><br>
 <input type="text" id="first_name" value="First Name" runat="server"><br>
 <input type="text" id="last_name" value="Last Name" runat="server"><br>
 <input type="text" id="company_name" value="Company Name" runat="server"><br>
 <input type="text" id="number" value="House Number" runat="server"><br>
 <input type="text" id="street" value="Street" runat="server"><br>
 <input type="text" id="town" value="Town" runat="server"><br>
 <input type="text" id="postcode" value="Postcode" runat="server"><br>
 <input type="text" id="telephone" value="Telephone" runat="server"><br>
 <input type="text" id="fax" value="Fax" runat="server"><br>
 <input type="text" id="email" value="Email" runat="server"><br>
 <input type="text" id="password" value="Password" runat="server"><br>
 <input type="text" id="web_address" value="Web Address" runat="server"><br>

 <input type="submit" OnServerClick="Submit_Click" value="Submit" runat="server"><br>
 
 </form>



</body>
</html>
0
pigmentarts
Asked:
pigmentarts
1 Solution
 
AerosSagaCommented:
That means that in your Access Database you have defined the text field too small to hold all the text you are trying to insert.  
1) Open the Access DB
2) Open the table in design view
3) select the fields that are in doubt and increase the max size, or set them to be a memo type which is for long text.
4) problem solved
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now