- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试创建一个电子邮件管理系统。以下是撰写电子邮件的代码,但它抛出错误“在结果集启动之前”。你能帮我一下吗?
String To = to.getText();
String Cc = cc.getText();
String Bcc = bcc.getText();
String Sub = sub.getText();
String Msg = text.getText();
if(To.equals("") || Sub.equals("") || Msg.equals(""))
{
JOptionPane.showMessageDialog(null, "Please Fill All Appropiate Details");
}
else
{
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection( "jdbc:mysql://localhost:3306/email management system","root", "ok" );
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select first,email,mail,name from login,curlogin;");
String from =rs.getString("mail");
String frmname =rs.getString("name");
String recipent = "";
String rname = "";
Boolean tof;
loop1: while(rs.next())
{
recipent = rs.getString("email");
rname = rs.getString("first");
if(recipent.equals(To))
{
tof = true;
break loop1;
}
else
{
tof= false;
}
}
if(tof=true)
{
stmt.executeUpdate("Insert into inbox Values('"+frmname+"','"+Sub+"','"+Msg+"',curDate(), curTime(),'"+rname+"','"+from+"');");
new inbox().setVisible(true);
this.dispose();
}
else
{
JOptionPane.showMessageDialog(null,"Sorry the 'To' Email you entered does not exist.");
}
ResultSet rs1 = stmt.executeQuery("select first,email,mail,name from login,curlogin;");
Boolean taf = false;
Boolean entered = false;
loop2: while(rs1.next())
{
recipent = rs1.getString("email");
rname = rs1.getString("first");
if(Cc.equals(""))
{
}
else
{
entered= true;
if(recipent.equals(Cc))
{
taf = true;
break loop2;
}
else
{
taf= false;
}
}
}
if(entered=true)
{
if(taf=true)
{
stmt.executeUpdate("Insert into inbox Values('"+frmname+"','"+Sub+"','"+Msg+"',curDate(), curTime(),'"+rname+"','"+from+"');");
new inbox().setVisible(true);
this.dispose();
}
else
{
JOptionPane.showMessageDialog(null,"Sorry the 'CC' Email you entered does not exist.");
}
}
ResultSet rs2 = stmt.executeQuery("select first,email,mail,name from login,curlogin;");
Boolean fot=false;
Boolean entered2 =false;
loop3: while(rs2.next())
{
recipent = rs2.getString("email");
rname = rs2.getString("first");
if(Bcc.equals(""))
{
}
else
{
if(recipent.equals(Bcc))
{
fot = true;
break loop3;
}
else
{
fot= false;
}
}
}
if(entered2=true)
{
if(fot=true)
{
stmt.executeUpdate("Insert into inbox Values('"+frmname+"','"+Sub+"','"+Msg+"',curDate(), curTime(),'"+rname+"','"+from+"');");
new inbox().setVisible(true);
this.dispose();
}
else
{
JOptionPane.showMessageDialog(null,"Sorry the 'CC' Email you entered does not exist.");
}
}
}
是否是因为创建了多个结果集?或者因为创建了多个 while 语句?
最佳答案
以下内容无效:
ResultSet rs = stmt.executeQuery("select first,email,mail,name from login,curlogin;");
String from =rs.getString("mail");
String frmname =rs.getString("name");
执行查询在位置 -1 处返回一个 ResultSet。您需要通过迭代器或首先调用 rs.next(); 来访问它(假设您有任何结果)。
关于java - 撰写消息错误。 "Before start of ResultSet.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34766760/
我对这个框架完全陌生。浏览所有文档后,我已经使用 visual studio 和类型脚本成功配置了 Aurelia 框架。我想知道如何在另一个 View 中组合一个 View ,并从其父 View 初
我有一个包含Nginx,php,redis和专用于SSH隧道的容器的Docker Compose文件。 我的Mac上有一个ssh配置文件,该文件可以在运行ssh my-tunnel时按预期工作,并且通
当我运行 docker-compose up 时,我得到这个错误: root@ubuntu:/home/benson/Docker/HaproxyMy# docker-compose up Recre
我有一个对话框,当我按下按钮时我无法关闭这是我的代码,我相信这是用于 if 循环的,但在那种情况下我需要它来实现它,有什么想法可以帮助我吗? @Composable fun PopupWind
我想在 Jetpack Compose 中创建曲线文本,就像在“Material You”中一样。但是怎么办?例子: 最佳答案 您可以使用 Canvas 来做到这一点。 Compose 本身没有绘制弯
我想选择我的 LazyColumn 中的一项并更改文本颜色。 如何识别选择了哪个项目? 代码: val items = listOf(Pair("A", 1), Pair("AA", 144), Pa
我很难确定我的问题是 Jetpack Compose 缺少功能还是我找不到它是如何完成的。 假设我想做这个页面 它需要可滚动,因为内容很长。 我还想使用惰性列来加载图像中显示的用户列表。 问题是您不能
我正在尝试在节点应用程序的 docker 容器内运行 webpack。我收到以下错误。 sh: 1: webpack: Permission denied Dockerfile 在正常构建上运行良好。
我有一个 React 应用程序,它也使用 Recompose和Redux . 它们都有一个内容非常相似的 compose 函数: Compose from Redux Compose from Rec
docker -ps -a CONTAINER ID IMAGE COMMAND CREATED S
在 javascript 世界中,这两种模式有什么区别吗? a(b)(c)(f) a(b(c(f))) 它们在功能上是相同的,并且都增加了调用堆栈的长度。 似乎组合模式(#1)更受欢迎,想知道我们有什
我怎样才能实现以下外观,其中有一个标题,然后是分隔线和一个用于输入正文的区域。看起来好像它几乎是一个 UITextView 最佳答案 很简单,他们使用两个字段。第一个是 UITextfield,允许您
我正在尝试查看是否有任何方法可以从网站(html/javascript)调用/启动 Outlook 撰写。此外,它还需要使用模板。 例如:我单击网页上的按钮,它将启动 Outlook 撰写邮件窗口,并
我有一个带有嵌套 LazyRows 的 LazyColumn(类似于 Netflix 或 Spotify 主页提要)。简而言之,我遇到的问题是当页面内容更改时,嵌套 LazyRow 的滚动位置不会重置
我需要为整个应用程序设置背景颜色。在 xml 中,我们使用 android:background在 fragment 或 Activity 中标记。 Compose 有什么模拟功能? Surface
在我的 fragment 中使用 Compose 时出现此错误,在 XML 的情况下可以正常工作ViewTreeLifecycleOwner not found from androidx.fragm
我正在尝试测试 Text在我的组件上我可以用不同的颜色打印它,所以在我的测试中我正在验证它是否获得了预期的颜色。我正在寻找一种返回颜色的方法,但我没有找到任何方法。 从现在开始,我断言文本是正确的并且
我正在尝试使用 Slick 3.0 编写查询,但似乎无法弄清楚。 等效的 SQL 是“insert into SavedMail select * from Inbox where Inbox.id
我使用 docker-compose,我使用 env 文件和我的局部变量。 我需要传递数组变量。 我试过了: TAGS="12345","67890" 或者 TAGS=["12345","67890"
我想将python集成到dotnet核心镜像中,因为我需要执行python脚本。 当我执行此DockerFile时,会创建许多悬空图像。 Dangling Images 另外,有没有适当的方法来集成p
我是一名优秀的程序员,十分优秀!