20 个解决方案
#1
插入数据用insert SQL语句
#2
支持楼上的
insert SQL 语句
insert SQL 语句
#3
对的。就是用insert SQL语句
托-福代-考www.helptest.org
托-福替-考www.turningcenter.com
托-福代-考www.helptest.org
托-福替-考www.turningcenter.com
#4
using System.Data.OleDb;
OleDbConnection conn = null;
try
{
OleDbCommand cmd = null;
String strConnection, strSQL;
strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";
strConnection += @"Data Source=C:\Northwind.mdb";
conn = new OleDbConnection(strConnection);
conn.ConnectionString = strConnection;
conn.Open();
strSQL = "INSERT INTO Employee (FirstName , LastName ) " +
"VALUES ( 'yi' , 'sun' )";
cmd = new OleDbCommand(strSQL, conn);
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
//error process
}
finally
{
if(conn != null)
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
}
}
OleDbConnection conn = null;
try
{
OleDbCommand cmd = null;
String strConnection, strSQL;
strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";
strConnection += @"Data Source=C:\Northwind.mdb";
conn = new OleDbConnection(strConnection);
conn.ConnectionString = strConnection;
conn.Open();
strSQL = "INSERT INTO Employee (FirstName , LastName ) " +
"VALUES ( 'yi' , 'sun' )";
cmd = new OleDbCommand(strSQL, conn);
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
//error process
}
finally
{
if(conn != null)
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
}
}
#5
老子是来灌水拿分的!
#6
这个跟sql一样的呀 都是 insert into *** () values()
#7
你好 使用 C#操作ACESS 需要导入system.忘记了哪个命名空间
诶
就用sql弄给模板给你好不
导入system.sqlclient;
然后
建立connection练级
建立command对象
执行;
demo:
诶
就用sql弄给模板给你好不
导入system.sqlclient;
然后
建立connection练级
建立command对象
执行;
demo:
using System.Data.SqlClient;
SqlConnection conn = new SqlConnection("server=localhost\\YANGZUJIE;uid=sa;pwd=11000;database=mytest");
conn.Open();
string str1 = "select * from the_user ";//sql语句(insert雷同)
SqlCommand cmd = new SqlCommand(str1, conn);//语句执行的comman对象
SqlDataReader dr = cmd.ExecuteReader();//执行;
#8
Access 不能好像是不能批量插入数据的!
所以插入多条的时候LZ就只能循环了!!很影响效率!
所以插入多条的时候LZ就只能循环了!!很影响效率!
#9
看看 学习学习
www.daikaola.com
www.daikaola.com
#10
#12
sql语句的insert into table-name values (''.'')
#13
你还是找个 dbhelper类用吧,方便很多。
#14
insert into sql
#15
insert into sql,但是在写的时候要注意,access数据库里面关键字很多,不像sql里面的关键字不加[]也能正确插入,access里面一定要加[],不然会报错
#16
就这个了!
#17
#18
可以结贴了
#19
insert values 后边不能跟变量吗
#20
Access insert的时候要注意 有列名对应写入的数据
#21
#1
插入数据用insert SQL语句
#2
支持楼上的
insert SQL 语句
insert SQL 语句
#3
对的。就是用insert SQL语句
托-福代-考www.helptest.org
托-福替-考www.turningcenter.com
托-福代-考www.helptest.org
托-福替-考www.turningcenter.com
#4
using System.Data.OleDb;
OleDbConnection conn = null;
try
{
OleDbCommand cmd = null;
String strConnection, strSQL;
strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";
strConnection += @"Data Source=C:\Northwind.mdb";
conn = new OleDbConnection(strConnection);
conn.ConnectionString = strConnection;
conn.Open();
strSQL = "INSERT INTO Employee (FirstName , LastName ) " +
"VALUES ( 'yi' , 'sun' )";
cmd = new OleDbCommand(strSQL, conn);
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
//error process
}
finally
{
if(conn != null)
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
}
}
OleDbConnection conn = null;
try
{
OleDbCommand cmd = null;
String strConnection, strSQL;
strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";
strConnection += @"Data Source=C:\Northwind.mdb";
conn = new OleDbConnection(strConnection);
conn.ConnectionString = strConnection;
conn.Open();
strSQL = "INSERT INTO Employee (FirstName , LastName ) " +
"VALUES ( 'yi' , 'sun' )";
cmd = new OleDbCommand(strSQL, conn);
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
//error process
}
finally
{
if(conn != null)
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
}
}
#5
老子是来灌水拿分的!
#6
这个跟sql一样的呀 都是 insert into *** () values()
#7
你好 使用 C#操作ACESS 需要导入system.忘记了哪个命名空间
诶
就用sql弄给模板给你好不
导入system.sqlclient;
然后
建立connection练级
建立command对象
执行;
demo:
诶
就用sql弄给模板给你好不
导入system.sqlclient;
然后
建立connection练级
建立command对象
执行;
demo:
using System.Data.SqlClient;
SqlConnection conn = new SqlConnection("server=localhost\\YANGZUJIE;uid=sa;pwd=11000;database=mytest");
conn.Open();
string str1 = "select * from the_user ";//sql语句(insert雷同)
SqlCommand cmd = new SqlCommand(str1, conn);//语句执行的comman对象
SqlDataReader dr = cmd.ExecuteReader();//执行;
#8
Access 不能好像是不能批量插入数据的!
所以插入多条的时候LZ就只能循环了!!很影响效率!
所以插入多条的时候LZ就只能循环了!!很影响效率!
#9
看看 学习学习
www.daikaola.com
www.daikaola.com
#10
#11
#12
sql语句的insert into table-name values (''.'')
#13
你还是找个 dbhelper类用吧,方便很多。
#14
insert into sql
#15
insert into sql,但是在写的时候要注意,access数据库里面关键字很多,不像sql里面的关键字不加[]也能正确插入,access里面一定要加[],不然会报错
#16
就这个了!
#17
#18
可以结贴了
#19
insert values 后边不能跟变量吗
#20
Access insert的时候要注意 有列名对应写入的数据