Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8214505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:29:09+00:00 2026-06-07T11:29:09+00:00

First off id like to note that this works when there is 1 row

  • 0

First off id like to note that this works when there is 1 row of information but not when there is many for some reason… which is what my question is about… As the code is decently long i will post it in pieces:

   int count = jTable1.getRowCount();

 for(int i=0;i<count;i++){
//uusi muodostus//


        SET0listm.add(i, txtTestiNIMI1.getText());
        System.out.println("SET0"+SET0listm);

…

    SAVED8listm.addElement(jTable1.getModel().getValueAt(i,7));
        System.out.println("SAVED8"+SAVED8listm);

    }

Move to string and remove extra parts for all like so:

    String SET0listmtostring = SET0listm.toString();
        SET0listmtostring = removeChar(SET0listmtostring, ']');
        SET0listmtostring = removeChar(SET0listmtostring, '[');

String sqla1 = "INSERT INTO MIT(MTY_KOD,MTY_TYY,MTY_ALU,MTY_PAR1,MTY_PAR2,MTY_TOL,MTY_KAN,MTY_DATE) "+"VALUES (?,?,?,?,?,?,?,?)";

 try{
   pst = conn.prepareStatement(sqla1);

   pst.setString(1, SET0listmtostring);
   pst.setString(2, SET2listmtostring);
   pst.setString(3, SET1listmtostring);
   pst.setString(4, SAVEDlistmtostring); 
   pst.setString(5, SAVED3listmmtostring); 
   pst.setString(6, SAVED5listmmtostring); 
   pst.setString(7, SET3listmtostring); 
   pst.setString(8, SET2listmtostring); 
   pst.executeUpdate();}
   catch (Exception e) {
   System.out.println("MITCLAUSE "+e);
        }

The last part catches

MITCLAUSE com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated.

Donno what teh problem is here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T11:29:11+00:00Added an answer on June 7, 2026 at 11:29 am

    Given the error, I suspect one of the strings you set is longer than the declared length of the column. In that case a driver has to throw an exception like this.

    So, check the lengths of your strings and compare them to the declared lengths of the columns in the table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off I would like to say that this is my first post and
First off the html row looks like this: <tr class=evenColor> blahblah TheTextIneed blahblah and
The first thing i would like to say is that this is not exactly
Note: This might seem like a Super User question at first, but please read
First off I would like to say, that I am not trying to hack
First off I would like to say that I think that my question may
First off, I would like to make clear, that I am SUPER NEW TO
First off, I'd like to say that I'm already looking into the Cutting Stock
this is my first post here. First off, some background, I'm new to C#
I have a simple SQLCMD script that includes some lines like this: /* Load

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.