In Add New Item Select Class And Language C#
Code for it:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
/// <summary>
/// Summary description for Class2
/// </summary>
public class Class2
{
SqlConnection con = new SqlConnection();
public Class2()
{
con.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|datadirectory|\\Database.mdf;Integrated Security=True;User Instance=True";
}
public DataSet calldata(string str)
{
SqlDataAdapter adp = new SqlDataAdapter(str, con);
DataSet ds = new DataSet();
adp.Fill(ds);
return ds;
}
public void savedata(string str)
{
SqlCommand cmd = new SqlCommand(str,con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
No comments:
Post a Comment