Dotnet, DotnetCore, Azure, C#,VB.net, Sql Server, WCF, MVC ,Linq, Javascript and Jquery
Showing posts with label C# Connectivity with Sql server. Show all posts
Showing posts with label C# Connectivity with Sql server. Show all posts
15 May 2010
Asp.net, C# Connectivity with Sql server
using System.Data.SqlClient;
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection myConnection = new SqlConnection("user id=userid;" + "password=pwd;" + "Data source=localhost;" + "Integrated security=true;" + "database=connectivitydb;");
try
{
myConnection.Open();
}
catch (Exception f)
{
Console.WriteLine(f.ToString());
}
SqlCommand myCommand = new SqlCommand("Command String", myConnection);
myCommand.CommandText = ("INSERT into agedetail(name,age)" + values('ramasamy',24)");
myCommand.ExecuteNonQuery();
try{
myConnection.Close();
}
catch (Exception f)
{
Console.WriteLine(f.ToString());
}
Asp.net, C# Connectivity with Sql server
using System.Data.SqlClient;
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection myConnection = new SqlConnection("user id=userid;" + "password=pwd;" + "Data source=localhost;" + "Integrated security=true;" + "database=connectivitydb;");
try
{
myConnection.Open();
}
catch (Exception f)
{
Console.WriteLine(f.ToString());
}
SqlCommand myCommand = new SqlCommand("Command String", myConnection);
//myCommand.Connection = myConnection;
myCommand.CommandText = ("INSERT into agedetail(name,age)" + "values('ramasamy',24)");
myCommand.ExecuteNonQuery();
try
{
myConnection.Close();
}
catch (Exception f)
{
Console.WriteLine(f.ToString());
}
}
Subscribe to:
Posts (Atom)
Implementing OAuth validation in a Web API
I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...
-
ViewBag, ViewData, TempData and View State in MVC ASP.NET MVC offers us three options ViewData, ViewBag and TempData for passing data from...
-
// Export Datatable to Excel in C# Windows application using System; using System.Data; using System.IO; using System.Windows.Forms; ...