- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我的数据库离线时,我没有遇到这个错误。我刚刚使用 db4free.net 使我的数据库联机。
每次登录都会出现此错误。有人能指出哪里出了问题吗?
private void btnLogIn_Click(object sender, EventArgs e)
{
string query = "select * from tbl_accounts where username='" + tbxUsername.Text + "' and password='" + tbxPassword.Text + "'";
MySqlCommand command = new MySqlCommand(query, connection);
MySqlDataAdapter da = new MySqlDataAdapter(command);
DataTable dt = new DataTable();
da.Fill(dt);
try
{
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = dt.Rows[i];
if (dt.Rows.Count > 0)
{
employee_id = (dr["employee_id"].ToString().PadLeft(4, '0'));
fullname = (dr["account_firstname"] + " " + dr["account_lastname"]).ToString();
this.Invoke(new Action(() =>
{
connection.Open();
command.ExecuteNonQuery();
connection.Close();
this.Close();
th = new Thread(openNewForm);
th.SetApartmentState(ApartmentState.STA);
th.Start();
}));
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
这是错误:
Updated: Here is my connection string:
MySqlConnection connection = new MySqlConnection("datasource=db4free.net;Convert Zero Datetime=True;SslMode=none");
最佳答案
距 OP 日期几乎正好 1 年,我在使用 NuGet 包 MySQL.Data 进行实验时遇到了相同的错误
我在这个 earlier StackOverflow post 的评论中找到了解决方法
基本上,您可以通过添加 OldGuids=True;
作为 MySQL 数据库连接字符串的一部分来避免错误,正如 @noontz 提到的。
但是,正如 @BradleyGrainger 所指出的,请注意,通过执行此操作,任何 BINARY(16)
列都将作为 Guid
而不是 返回>字节[]
。
关于时间:2019-03-17 标签:c#-System.FormatException: 'Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52851292/
为什么这个指数在使用 Decimal.Parse 转换为小数时会抛出 FormatException。 String stringValue = "8.83080183680678E-05"; Dec
每当我尝试在数据库中插入日期时,我都会收到 formatException。 我将日期转换为字符串并尝试插入到数据库中。我已经尝试了所有方法,但它被捕获为异常。找到下面的代码: $ DateTime
在我的 SQL Server Management Studio 中,我创建的其中一个表 (ACTION_LOCATION_MAP) 具有以下设计: 在我的一个函数中,我正在调用一个存储过程来检索所有
我收到 FormatException,我不知道为什么。 System.FormatException was unhandled by user code Message=Input strin
所以我还在学习C#,我有一点问题。我正在制作一个非常简单的 Windows 窗体应用程序,有两个文本框,输入和输出,用于从十六进制到十进制的转换。这是我的代码: string inpu
此行抛出 FormatException: var dataString = string.Format("email_address:{0}, status:subscribed, merge_fi
我的代码是 objVehicle.TaxAmount = CalculateTax_TaxableVeh( objVehicle.IsLogging, Convert.ToChar
我已经在座位上坐了一个多小时了,不知道出了什么问题。有人可以帮忙吗? 错误据说是“将字符串转换为 DateTime 时,在将每个变量放入 DateTime 对象之前解析字符串以获取日期。 字段名称“L
我正在使用 C# Windows 应用程序 2010 Express。这里我有 3 个文本框,用于显示总费用、支付金额、应付金额。总费用应从 DB 获取,支付金额应由用户输入,应付金额应由系统计算。这
从 Unity 2018.1.something 切换到 2018.2.0.b3 后,我无法再为 Android 构建,我得到: FormatException: Input string was n
我正在使用 visual studio 2008 开发适用于 windows CE 6.0 的紧凑型框架软件。 我有这个“奇怪的?” isNumeric 方法有问题。还有其他更好的方法来完成这项工作吗
在此 DatePicker 中,如果我输入无效日期,例如 20001 年 1 月 1 日(输入键) 我得到以下异常 A first chance exception of type 'System.F
有人帮我解决了另一个问题,并给了我一个非常有效的代码示例。我尝试稍微调整一下以写入文件而不是控制台,但出现以下错误: System.FormatException: String 未被识别为有效的 D
我创建了一个包含一些列的 DataGridView。顺序栏只允许用户输入整数。当我输入“j”(例如)并尝试添加 try catch 来解决问题时它抛出 FormatException,但它看起来不起作
这个问题在这里已经有了答案: Why does TimeSpan.ParseExact not work (6 个答案) 关闭 9 年前。 我想从格式为“MM:SS”的字符串中提取总秒数。例如:01
我创建了一个程序,并对其进行了广泛的测试,我收到一条错误消息,提示“FormatException 未处理,输入字符串的格式不正确”。当我将任一文本框留空并按下“完成”按钮时会出现问题,但如果我输入低
我在尝试修复简单的 C# 代码时遇到了问题。这是代码: using System; using System.Collections.Generic; using System.Linq; using
我正在为 iPad 应用程序制作一些服务,以使用广告发送数据到 CRM Dynamics。在这个过程中,我遇到了这个奇怪但又令人着迷的问题。 我必须将 Guid 分配给一些尚未分配给其他实体的记录。因
这个问题在这里已经有了答案: How to escape braces (curly brackets) in a format string in .NET (12 个答案) 关闭 9 年前。 我
我遇到的问题尤其与 CSVHelper 库有关。 我的 csv 文件看起来像这样: Number,Date,Account,Amount,Subcategory,Memo ,09/05/2017,X
我是一名优秀的程序员,十分优秀!