csharp D B
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp D B相关的知识,希望对你有一定的参考价值。
using System.Data.OleDb;
public static void ReadFromAccess()
{
int param1Index;
string param1;
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=[filelocation]");
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT * FROM MachineList";
conn.Open();
OleDbDataReader dr = cmd.ExecuteReader();
DataTable dt = new System.Data.DataTable();
while (dr.Read())
{
param1Index=dr.GetOrdinal("[param1]");
param1 = dr.GetString(param1Index);
}
conn.Close();
}
String mysqlStr = "Database=automachine;Data Source=127.0.0.1;User Id=root;Password=Demo123;pooling=false;CharSet=utf8;port=3306";
MySqlConnection mysql = new MySqlConnection(mysqlStr);
mysql.Open();
String sqlUpdate = "UPDATE automachine.t_deviceinfo SET param1='1' WHERE param2= 'hello'";
MySqlCommand mySqlCommand = new MySqlCommand(sqlUpdate, mysql);
getUpdate(mySqlCommand);
mysql.Close();
以上是关于csharp D B的主要内容,如果未能解决你的问题,请参考以下文章
csharp 931BA7AB-945D-427E-B1B6-2A58DD87647B
csharp 当(a + b)=(c + d)时,使用嵌套for循环打印“幸运数字”的示例。从计算机编程基础与C#http:// www
csharp 当(a + b)=(c + d)时,使用嵌套for循环打印“幸运数字”的示例。从计算机编程基础与C#http:// www
csharp 示例 - CSHARP - 报告 - GenerateReport-GenerateMulticoloredNumberedListReportFromJsoninWord.cs
csharp ABC115D.cs
csharp GenericStringParserExtensionMethod.cs