Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
clientdata.cs
using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Assignment { public class CustomerDetails{ public string connection = ConfigurationManager.ConnectionStrings["Con"].ConnectionString; public void get_details() { SqlConnection con = new SqlConnection(connection); con.Open(); string query = "Select * from customer_details"; SqlCommand cmd=new SqlCommand(query, con); SqlDataReader r = cmd.ExecuteReader(); while (r.Read()) { Console.WriteLine("Customer ID : "+ r[0].ToString()); Console.WriteLine("Customer Name : " + r[1].ToString()); Console.WriteLine("Phone Number : " + r[2].ToString()); Console.WriteLine("Email id : " + r[3].ToString()); Console.WriteLine("City : " + r[4].ToString()); } con.Close(); } public void get_details_dataset() { SqlConnection con = new SqlConnection(connection); con.Open(); string query = "Select * from customer_details"; SqlCommand cmd = new SqlCommand(query,con); SqlDataAdapter s = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); s.Fill(ds, "customer_details"); foreach (DataRow r in ds.Tables["customer_details"].Rows) { Console.WriteLine("Customer ID : " + r[0].ToString()); Console.WriteLine("Customer Name : " + r[1].ToString()); Console.WriteLine("Phone Number : " + r[2].ToString()); Console.WriteLine("Email id : " + r[3].ToString()); Console.WriteLine("City : " + r[4].ToString()); } con.Close(); } } }
run
|
edit
|
history
|
help
0
Escape's Vanity Fair (Malformed \p {X} character escape)
PrecisionTester
adxsadxcasxsd
Zadanka
Nested Namespace
Saga name NLog
Rijndael
Compiler
john
arrays bidimencionales y tridimencionales