机顶号码格式异常 [英] Jackcess Numberformatexception

查看:170
本文介绍了机顶号码格式异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个程序,该程序从CSV文件中获取输入并将其写入Java创建的Access数据库和表中.该程序使用while循环浏览CSV文件.该文件的第一行完美地写入了数据库,但是在尝试向表中写入相同类型的输入时,它在第二行崩溃.我该如何解决?到目前为止,这是我的代码:

I'm trying to create a program which takes input from a CSV-file and writes it to a Java-created Access database and table. The program uses a while-loop to go through the CSV-file. The first line of the file is written perfectly to the database, but it crashes at the second line, while trying to write the same kind of input to the table. How can I solve this? Here's my code so far:

public void GPXtoAccess() {
    try {
        Access = new Scanner(DummyCSV);
        Scanner = new Scanner(DummyCSV);

        while (Access.hasNextLine()) {
            Scanner.useDelimiter(";");
            GPXlat = Scanner.next();
            GPXlon = Scanner.next();
            GPXtime = Scanner.next();
            GPXname = Scanner.next();
            GPXdesc = Scanner.next();

            try {
                GPXTable.addRow(Column.AUTO_NUMBER, GPXlat, GPXlon, GPXtime, GPXname, GPXdesc);
            } catch (IOException T) {
                System.out.println("Error: " + T);
                System.out.println("Error is thrown while writing data to table");
            }
        }
    } catch (FileNotFoundException M) {
        System.out.println("Error: " + M);
    }
}

推荐答案

很可能您可能会尝试将字符串类型1转换为数字类型.请检查您要使用的数据的数据类型.

Most probably you may try to convert a String type one to a numeric type. Please check data types of your data that you are trying to use.

这篇关于机顶号码格式异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆