Download code from:
https://github.com/hamza3344/desktopd...
My fiverr link: https://www.fiverr.com/hamzakhalid178
My Upwork Profile: https://www.upwork.com/freelancers/~0...
Whatsapp Number: +923338672398
if you have any problem comment below. please like, share and subscribe the channel. Contact me on [email protected] if you need any custom software, website and mobile Application.
code:
//Initization of the connectionString
private string ConnectionString = "Data Source=.\\SQLEXPRESS;initial Catalog=master;Integrated Security=true;";
private SqlCommand comd = null;
private SqlConnection conn = null;
//create the function for database
public void CreateDatabase()
{
string dir = "C:\\simpleform";
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
conn = new SqlConnection(ConnectionString);
if (conn.State != ConnectionState.Open)
conn.Open();
string sql = @"create database simpleform on primary (Name=simpleform_data,filename='C:\\simpleform\\simpleform_data.mdf',size=5,maxsize=20,filegrowth=1)";
comd = new SqlCommand(sql, conn);
comd.ExecuteNonQuery();
conn.Close();
conn.ConnectionString = "Data Source=.\\SQLEXPRESS;initial Catalog=simpleform;Integrated Security=true;";
if (conn.State != ConnectionState.Open)
conn.Open();
sql= @"CREATE TABLE [dbo].[simpletable](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](50) NOT NULL,
[location] [varchar](50) NOT NULL,
CONSTRAINT [PK_simpletable] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]";
comd = new SqlCommand(sql, conn);
comd.ExecuteNonQuery();
}
}
Watch video How to install desktop application with database in client computer in c# using sql express online without registration, duration hours minute second in high quality. This video was added by user IT Core Soft 16 January 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 925 once and liked it 11 people.