java.lang.NullPointerException和ResultSet(java.lang.NullPointerException and ResultSet)
这是我的第一篇文章,请耐心等待。 我正在研究一个java项目,它连接到一个sql数据库。 我目前要做的是当我单击一个按钮时,将在我的数据库的文本区域中显示项目的名称和具有指定ID的项目的价格。 但是,当我单击该按钮时,会出现如下错误:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at OrderFrame.waterButtonActionPerformed(OrderFrame.java:494) at OrderFrame.access$000(OrderFrame.java:11)
这是我的waterButtonActionPerformed的代码:
private void waterButtonActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try{ String query; query = "SELECT itemName, itemPrice FROM item WHERE itemID = '11111'"; String itemName = " ",itemPrice =" "; ***ResultSet rs = st.executeQuery(query);*** if(rs != null){ while(rs.next()) { itemName = rs.getString(1); itemPrice = rs.getString(2); } orderTextArea.setText(itemName); orderTextArea.setText(itemPrice); } } catch (SQLException ex) {} }
第494行是具有ResultSet声明的行。 我希望有人可以帮我解决这个问题。 先谢谢你。
This is my first post so please be patient. I am working on a java project and that connects to a sql database. What I am currently trying to do is when I click a button, will display the name of the item and the price of the item with the specified ID in the text area from my database. However, when I click the button an error such as this appears:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at OrderFrame.waterButtonActionPerformed(OrderFrame.java:494) at OrderFrame.access$000(OrderFrame.java:11)
Here is the code for my waterButtonActionPerformed:
private void waterButtonActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try{ String query; query = "SELECT itemName, itemPrice FROM item WHERE itemID = '11111'"; String itemName = " ",itemPrice =" "; ***ResultSet rs = st.executeQuery(query);*** if(rs != null){ while(rs.next()) { itemName = rs.getString(1); itemPrice = rs.getString(2); } orderTextArea.setText(itemName); orderTextArea.setText(itemPrice); } } catch (SQLException ex) {} }
The line 494 is the one with the declaration of the ResultSet. I am am hoping someone can help me fix this issue. Thank you in advance.
原文:https://stackoverflow.com/questions/15794369
最满意答案
Twilio开发者传道者在这里。
如果您正在寻找使用Twilio拨打电话,我建议您按照此快速入门指南使用C#拨打电话 。 它将带您了解基础知识。
为了更深入地了解一下,我将通过本教程来了解如何使用C#ASP.NET MVC构建一个单击调用系统 。
如果这有帮助,请告诉我。
I am able to solve the issue . As I already had
hiro usb modem h50113
so i just used AT Command
ATDT (Phone number)
here is the code :
this.sp.WriteLine("ATDT 1234567890" + System.Environment.NewLine);
However , only it can ring , theirs no voice . Working on it as soon as I get it will post.
one can refer my old question for better understanding How to make caller id in c#.net
相关问答
更多-
首先,你必须小心录制电话,因为有国家的法律要求。 以下是关于如何使用MediaRecorder录制音频的博客文章 。 我没有尝试录制电话,但MediaRecorder AudioSource中有一个选项用于: VOICE_CALL - 语音呼叫上行链路+下行音频源 VOICE_DOWNLINK - 语音呼叫下行(Rx)音频源 VOICE_UPLINK - 语音呼叫上行链路(Tx)音频源 只要音源选项有效,你应该很好。 First off, you have to be careful with record ...
-
您可以发起呼叫 https://developer.apple.com/library/content/featuredarticles/iPhoneURLScheme_Reference/PhoneLinks/PhoneLinks.html 所以这可能会工作 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:12125551212"]]; You can initiate a call https://devel ...
-
您将不得不捕获广播的消息:
-
看起来您想要传递SendDigits可选参数以及出站API调用。 有关更多信息,请在进行Twilio API调用时查看此可选参数列表 After thoroughly review the documentation, I found a
noun for the verb that allows to provide sendDigits parameter. So my problem has been solved. Thanks to all of you for y ... -
使用telnet从一个Android模拟器拨打电话到另一个?(Make calls using telnet from one Android Emulator to another?)[2022-12-30]
对的,这是可能的。 使用以下步骤: 启动两个仿真器(例如,5556和5558) 在窗户上开始; 键入cmd; 并键入telnet localhost 5556,您将连接到端口5556上的仿真器 现在键入gsm call 5556 通过点击/绘制绿色电话到右侧来接收模拟器5556上的呼叫。 点击模拟器5556屏幕上带有+号的添加呼叫按钮。 在拨号盘上拨打号码5558并点击绿色电话图标。 你会听到它正在响起另一个模拟器5558。 在仿真器5558上,您将在一段时间后看到来电通知。 通过点击并接着点击电话图标和绿 ... -
在Phonegap 4中拨打电话(Make Phone Calls in Phonegap 4)[2023-08-07]
尝试这个 call this number 看一下这个 在Android和iOS中通过PhoneGap拨打电话 try this call this number check this out Making a Phone Call from Within PhoneGap in Android and iOS -
这不能在iOS中完成,因为它是Apple强制执行的技术限制。 This cannot be done in iOS as its a technical restriction enforced by Apple.
-
我设法提出了一个解决方案,以获得问题中描述的行为。 在我的问题中,我使用了相同的tel:// “link”概念。 我提出的解决方案: 创建一个URI 从应用程序启动它 然后设备处理打开URI; 询问必要时使用哪个应用程序 这就像一行一样简单: private async Task MakePhoneCall(string phoneNumber) { await Launcher.LaunchUriAsync(new Uri($"tel://{phoneNumber}")); } Launcher ...
-
如何在c#中拨打电话(How to make outgoing calls in c#)[2023-11-24]
Twilio开发者传道者在这里。 如果您正在寻找使用Twilio拨打电话,我建议您按照此快速入门指南使用C#拨打电话 。 它将带您了解基础知识。 为了更深入地了解一下,我将通过本教程来了解如何使用C#ASP.NET MVC构建一个单击调用系统 。 如果这有帮助,请告诉我。 I am able to solve the issue . As I already had hiro usb modem h50113 so i just used AT Command ATDT (Phone number) her ... -
我使用没有弹性中继的PHP帮助程序库来完成它。 在Twilio控制台的SIP域设置中,您可以设置语音配置的请求URL。 似乎当您尝试通过SIP拨打任何号码时,Twilio会请求此URL并使用请求POST所有呼叫信息变量。 其中一个变量是'Called',格式为sip:0123456789@yourdomain.sip.us1.twilio.com:5060其中0123456789是您拨打的号码 所以我们需要做的就是从字符串中删除数字,然后让Twilio拨打它。 很容易。 我创建了这个php文件,我在英国,因 ...