标签:
string dataPath = "../../UserData.dbx"; //System.IO.Directory.GetCurrentDirectory() + "\\UserData.dbx"; SQLiteConnection.CreateFile(dataPath); SQLiteConnection conn = new SQLiteConnection("Data Source=" + dataPath); conn.Open(); SQLiteCommand cmd = new SQLiteCommand(); cmd.CommandText = "create table Users (UserID int primary key,UserName varchar(100) not null,UserPassword varchar(100) not null)"; cmd.Connection = conn; cmd.ExecuteNonQuery(); for (int i = 0; i < 10; i++) { cmd.CommandText = "insert into Users (UserID,UserName,UserPassword) values (" + i + ",‘TestUser_" + i + "测试‘,‘" + DateTime.Now.ToString().Replace(" ", "-").Replace(":", "-") + "‘)"; cmd.ExecuteNonQuery(); }
标签:
原文地址:http://www.cnblogs.com/love-zf/p/5764001.html