using UnityEngine;
using System.Collections;
using System.Data.SqlClient;
using System.Data;
public class SQLTest : MonoBehaviour {
SqlConnection con = null;
SqlDataAdapter sda = null;
// Use this for initialization
void Start () {
string s = @"Server=192.168.1.116;Initial Catalog=Test;User ID=sa;Password=123";
con = new SqlConnection(s);
con.Open();
print(con.StatisticsEnabled);
string sql = "select * from Table_1";
sda = new SqlDataAdapter(sql, con);
DataSet ds = new DataSet();
sda.Fill(ds, "Table_1");
print(ds.Tables[0].Rows[0][0]);
}
}
Unity 连接SQL Server 数据库及接受测试
最新推荐文章于 2020-09-27 17:36:19 发布