headmax:Is SQL Query Analyzer part of VWD? My question was if the key reset is possible to do inside of VWD...
Query Analyzer is part of SQL Server but still you can use QA within Visual Studio by opening the Server Explorer. To open it then you can follow the following steps:
- In Visual Studio Go to View Tab
- Select Server Explorer
- Under Data Connections Open your DataBase
- Expand the Tables within your DB
- Find the Table that you want to use
- Right Click on the Table and Select "New Query"
- Write the Script there
Another way would be using SqlClient objects and code it your self. Here's an example:
private string GetConnectionString()
{
return System.Configuration.ConfigurationManager.ConnectionStrings["DBConnection"].ConnectionString;
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection connection = new SqlConnection(GetConnectionString());
string sqlStatement = "DBCC CHECKIDENT ('TableName', RESEED, 0)";
connection.Open();
SqlCommand cmd = new SqlCommand(sqlStatement, connection);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
connection.Close();
}