To avoid meet the problem again, I memo the solution here.
While installing SQLServer 2008 on Windows 7 64bit - Traditional Chinese Version.
I got an error message told me "Performance counter registry hive consistency check".
It would not happen on English version OS.
Here is an article will help.
http://www.dotblogs.com.tw/lastsecret/archive/2010/06/14/15865.aspx
In addition, you should execute window update to download Visual Studio 2008 sp1 if you like to install SQL Server 2008 Management Studio. Otherwise you'll got error message as "Another version of Microsoft Visual Studio 2008 has been detected on this system that must be updated to SP1. Please update all Visual Studio 2008 installations to SP1 level, by visiting Microsoft Update."
Murmur of a rookie software engineer came from Taiwan.
(Sorry for my poor English, I just practice it here.)
Please feel free to contact me for anything: ninna.tw@gmail.com
2012年8月12日 星期日
2011年12月16日 星期五
[SQLite] Truncate table
In SQL server or mysql, you can delete all data from a table and set auto-increment identity to zero by the command below:
TRUNCATE TABLE [TableName];
In SQLite, there is no command for truncate tables, you should remove data and set identity by yourself.
DELETE FROM [TableName];
UPDATE sqlite_sequence SET seq=0 WHERE name=' TableName';
TRUNCATE TABLE [TableName];
In SQLite, there is no command for truncate tables, you should remove data and set identity by yourself.
DELETE FROM [TableName];
UPDATE sqlite_sequence SET seq=0 WHERE name=' TableName';
2011年12月13日 星期二
[.Net] Create SQLite database and datatable with .net framework
This is sample code for creating a new database file and table in SQLite.
string m_dataSource = "test1.s3db";
SQLiteConnection.CreateFile(m_dataSource);
DbProviderFactory factory = SQLiteFactory.Instance;
using (DbConnection conn = factory.CreateConnection())
{
// Create DB
conn.ConnectionString = "Data Source=" + m_dataSource;
conn.Open();
// Create Table
string sql = "create table [aa] ([id] INTEGER PRIMARY KEY, [s] TEXT COLLATE NOCASE)";
DbCommand cmd = conn.CreateCommand();
cmd.Connection = conn;
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
}
Reference:
http://hirocat.pixnet.net/blog/post/40514692-%E5%A6%82%E4%BD%95%E9%AB%98%E6%95%88%E4%BD%BF%E7%94%A8sqlite-.net-(c%23)
string m_dataSource = "test1.s3db";
SQLiteConnection.CreateFile(m_dataSource);
DbProviderFactory factory = SQLiteFactory.Instance;
using (DbConnection conn = factory.CreateConnection())
{
// Create DB
conn.ConnectionString = "Data Source=" + m_dataSource;
conn.Open();
// Create Table
string sql = "create table [aa] ([id] INTEGER PRIMARY KEY, [s] TEXT COLLATE NOCASE)";
DbCommand cmd = conn.CreateCommand();
cmd.Connection = conn;
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
}
Reference:
http://hirocat.pixnet.net/blog/post/40514692-%E5%A6%82%E4%BD%95%E9%AB%98%E6%95%88%E4%BD%BF%E7%94%A8sqlite-.net-(c%23)
訂閱:
文章 (Atom)