Snip2Code is shutting down.
It has been quite a ride, since 2013 when we launched our first prototype: thanks to the effort of you guys we collected more than 3 million snippets!
We are very proud to help all our users to be more efficient in their jobs, and to be the central point to share programming knowledge for everyone.
Our basic service is free, so we always survived on our own resources to give you Snip2Code.
Unfortunately, we are no more in the financial position to sustain this effort, and therefore we are announcing here our permanent shut down,
which will take place on August 1st, 2020.
Please save your private snippets using our backup function in the settings, here.
IF YOU WANT TO SAVE SNIP2CODE, PLEASE CONSIDER DOING A DONATION!
This will allow us to pay for the servers and the infrastructure. If you want to donate, Contact Us!
by
0
6
1,225
2
Top 1% !
Famous
Easy-to-find
Specified
Refined
OpenSource
Popularity: 22839th place

Published on:

InputName0connString
InputType0String
LanguageCSharp
LicenseMIT_X11
MethodNameCreateTable
OSWindows
OutputTypeBoolean

CreateTable: If there's no table [dbo].[Products] in DbDataIsolationLevel, create           the table; or recreate it.

<summary>
If there's no table [dbo].[Products] in DbDataIsolationLevel, create
the table; or recreate it.
</summary>
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/287718/CreateTable--If-there-s-no-table--dbo---?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
using System; using System.Data.SqlClient; /// <summary> /// If there's no table [dbo].[Products] in DbDataIsolationLevel, create /// the table; or recreate it. /// </summary> public static Boolean CreateTable(String connString) { using (SqlConnection conn = new SqlConnection(connString)) { String cmdText = @"Use DbDataIsolationLevel if Object_ID('[dbo].[Products]') is not null drop table [dbo].[Products] Create Table [dbo].[Products] ( [ProductId] int IDENTITY(1,1) primary key, [ProductName] NVarchar(100) not null, [Quantity] int null, [Price] money null )"; using (SqlCommand command = new SqlCommand(cmdText, conn)) { conn.Open(); command.ExecuteNonQuery(); } } return InsertRows(connString); }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus