sql错误:数据类型 [英] sql error: data types

查看:78
本文介绍了sql错误:数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我想从我在java中开发的应用程序插入数据到ms访问,但我想我有一个数据类型的概率。


这是我的代码。

[code]


savebutton.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

尝试{


Class.forName(" sun.jdbc.odbc.JdbcOdbcDriver");
< br $>
con = DriverManager.getConnection(url);


String sqlStatement =" INSERT INTO PatientDB(PatientID,Name,Surname,Phoneno,Dateofbir th,Complaint) values(numberinput.getInteger(),nameinput.getText(),surnameinput.getText(),phoneinput.getInteger(),d ateofbirthinput.getInteger(),text.getText())" ;;

PreparedStatement pstmt = con.prepareStatement(sqlStatement);

pstmt.executeUpdate();


con.close();



}


catch(ClassNotFoundException ex)

{}



catch(SQLException ex)

{

ex.printStackTrace();

}

}

});

[\代码]






[错误]


嗨。我想插入数据到ms访问,但我想我有一个数据类型的概率。


这是我的代码。

[code]


savebutton.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

尝试{


Class.forName(" sun.jdbc.odbc.JdbcOdbcDriver");


con = DriverManager.getConnection(url);


String sqlStatement =" insert into PatientDB(PatientID,Name,Surname,Phoneno,Dateofbir th,Complaint)值(numberinput.getInteger() ,nameinput.getText(),surnameinput.getText(),phoneinput.getInteger(),d ateofbirthinput.getInteger(),tet.getText())" ;;

PreparedStatement pstmt = con.prepareStatement( sqlStatement);

pstmt.executeUpdate();


con.close();


>
}


catch(ClassNotFoundException ex)

{}


catch (SQLException ex)

{

ex.printStackTrace();

}


}

});

[\代码]




[错误]


java.sql.SQLException:[Microsoft] [ODBC Microsoft Access驱动程序]未定义的函数''numberinput.getText''在表达式中。

[\ error]

[\ error]

Hi. I want to insert data to ms access from an application I developed in java but I think I have a prob with data types.

This is my code.
[code]

savebutton.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
try{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

con= DriverManager.getConnection(url);

String sqlStatement = "INSERT INTO PatientDB(PatientID,Name,Surname,Phoneno,Dateofbir th,Complaint) values(numberinput.getInteger(),nameinput.getText( ),surnameinput.getText(),phoneinput.getInteger(),d ateofbirthinput.getInteger(),text.getText())";
PreparedStatement pstmt = con.prepareStatement(sqlStatement);
pstmt.executeUpdate();


con.close();


}

catch(ClassNotFoundException ex)
{}


catch(SQLException ex)
{
ex.printStackTrace();
}

}
});
[\code]





[error]

Hi. I want to insert data to ms access but I think I have a prob with data types.

This is my code.
[code]

savebutton.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
try{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

con= DriverManager.getConnection(url);

String sqlStatement = "insert into PatientDB(PatientID,Name,Surname,Phoneno,Dateofbir th,Complaint) values(numberinput.getInteger(),nameinput.getText( ),surnameinput.getText(),phoneinput.getInteger(),d ateofbirthinput.getInteger(),tet.getText())";
PreparedStatement pstmt = con.prepareStatement(sqlStatement);
pstmt.executeUpdate();


con.close();


}

catch(ClassNotFoundException ex)
{}


catch(SQLException ex)
{
ex.printStackTrace();
}

}
});
[\code]





[error]

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Undefined function ''numberinput.getText'' in expression.
[\error]
[\error]

推荐答案


嗨。我想从我在java中开发的应用程序插入数据到ms访问,但我想我有一个数据类型的概率。


这是我的代码。

[code]


savebutton.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

尝试{


Class.forName(" sun.jdbc.odbc.JdbcOdbcDriver");
< br $>
con = DriverManager.getConnection(url);


String sqlStatement =" INSERT INTO PatientDB(PatientID,Name,Surname,Phoneno,Dateofbir th,Complaint) values(numberinput.getInteger(),nameinput.getText(),surnameinput.getText(),phoneinput.getInteger(),d ateofbirthinput.getInteger(),text.getText())" ;;

PreparedStatement pstmt = con.prepareStatement(sqlStatement);

pstmt.executeUpdate();


con.close();



}


catch(ClassNotFoundException ex)

{}



catch(SQLException ex)

{

ex.printStackTrace();

}

}

});

[\代码]






[错误]


嗨。我想插入数据到ms访问,但我想我有一个数据类型的概率。


这是我的代码。

[code]


savebutton.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

尝试{


Class.forName(" sun.jdbc.odbc.JdbcOdbcDriver");


con = DriverManager.getConnection(url);


String sqlStatement =" insert into PatientDB(PatientID,Name,Surname,Phoneno,Dateofbir th,Complaint)值(numberinput.getInteger() ,nameinput.getText(),surnameinput.getText(),phoneinput.getInteger(),d ateofbirthinput.getInteger(),tet.getText())" ;;

PreparedStatement pstmt = con.prepareStatement( sqlStatement);

pstmt.executeUpdate();


con.close();


>
}


catch(ClassNotFoundException ex)

{}


catch (SQLException ex)

{

ex.printStackTrace();

}


}

});

[\代码]




[错误]


java.sql.SQLException:[Microsoft] [ODBC Microsoft Access驱动程序]未定义的函数''numberinput.getText''在表达式中。

[\ error]

[\ error]
Hi. I want to insert data to ms access from an application I developed in java but I think I have a prob with data types.

This is my code.
[code]

savebutton.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
try{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

con= DriverManager.getConnection(url);

String sqlStatement = "INSERT INTO PatientDB(PatientID,Name,Surname,Phoneno,Dateofbir th,Complaint) values(numberinput.getInteger(),nameinput.getText( ),surnameinput.getText(),phoneinput.getInteger(),d ateofbirthinput.getInteger(),text.getText())";
PreparedStatement pstmt = con.prepareStatement(sqlStatement);
pstmt.executeUpdate();


con.close();


}

catch(ClassNotFoundException ex)
{}


catch(SQLException ex)
{
ex.printStackTrace();
}

}
});
[\code]





[error]

Hi. I want to insert data to ms access but I think I have a prob with data types.

This is my code.
[code]

savebutton.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
try{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

con= DriverManager.getConnection(url);

String sqlStatement = "insert into PatientDB(PatientID,Name,Surname,Phoneno,Dateofbir th,Complaint) values(numberinput.getInteger(),nameinput.getText( ),surnameinput.getText(),phoneinput.getInteger(),d ateofbirthinput.getInteger(),tet.getText())";
PreparedStatement pstmt = con.prepareStatement(sqlStatement);
pstmt.executeUpdate();


con.close();


}

catch(ClassNotFoundException ex)
{}


catch(SQLException ex)
{
ex.printStackTrace();
}

}
});
[\code]





[error]

java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Undefined function ''numberinput.getText'' in expression.
[\error]
[\error]





发布代码时请使用代码标签。它使其他人可读。

检查您的查询。他们调用函数来获取查询中的值是错误的。

Hi,
Please use code tags while posting code. It makes it readable for other people.
Check your query. They way you are calling functions to get values inside query is wrong.


使用代码标签。

我认为你的查询字符串将是这样的。

Use Code Tags.
I think your Query string will be like this.

展开 | 选择 | Wrap | 行号





发布代码时请使用代码标签。它使其他人可读。

检查您的查询。他们调用函数来获取查询中的值是错误的。
Hi,
Please use code tags while posting code. It makes it readable for other people.
Check your query. They way you are calling functions to get values inside query is wrong.




我无法弄清楚出了什么问题。请你写一下。




I couldnt figure out what is wrong.Please can you write.


展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号


这篇关于sql错误:数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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