求救 c#从索引 33 处开始,初始化字符串的格式不符合规范
using System;using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
string ID = this.mane.Text;
string k1 = this.ke.Text;
string k2 = this.key2.Text;
string conStr = @"Provider=Microsoft.Jet.OLEDB.4.0;C:\Documents and Settings\admin\My Documents\Visual Studio 2008\Projects\test\CMS_DataManager.mdb";
if (k1 != k2)
{
MessageBox.Show("两次输入的密码不一致 \n 请重新输入!");
return;
}
string m = "select strUserName from SysBldUserDefine where strUserName=this.mane.Text";
string i = "insert into SysBldUserDefine (strUserName,strUserPassword) values ('this.mane.Text','this.ke.Text')";
OleDbConnection conn = new OleDbConnection(conStr);
OleDbCommand cmd = new OleDbCommand(m, conn);
try
{
conn.Open();
cmd.Parameters.Add(new OleDbParameter("mane", m));
int cnt = (int)cmd.ExecuteScalar();
if (cnt == 0)
{
cmd = new OleDbCommand(i, conn);
cmd.Parameters.Add(new OleDbParameter("strUserName", ID));
cmd.Parameters.Add(new OleDbParameter("strUserPassword", k1));
cmd.ExecuteNonQuery();
MessageBox.Show("注册成功!");
}
else
{
MessageBox.Show("该用户已存在 \n 请重新注册!");
}
}
catch(Exception ex)
{
MessageBox.Show("出现错误!");
}
finally
{
if (conn != null) conn.Close();
}
}
private void button2_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
this.Hide();
f2.ShowDialog();
}
补充:.NET技术 , C#