X hits on this document

137 views

0 shares

0 downloads

0 comments

39 / 42

 SqlConnection c = new SqlConnection(…);

 c.Open();

 SqlCommand cmd = new SqlCommand(

@“SELECT c.Name, c.Phone

     FROM Customers c

     WHERE c.City = @p0”

);

 cmd.Parameters[“@po”] = “London”;

 DataReader dr = c.Execute(cmd);

 while (dr.Read()) {

    string name = r.GetString(0);

    string phone = r.GetString(1);

    DateTime date = r.GetDateTime(2);

 }

 r.Close();

Old Data Access in API’s

Queries in quotes

Arguments loosely bound

Results loosely typed

Compiler cannot help catch mistakes

Document info
Document views137
Page views137
Page last viewedFri Jan 20 10:11:35 UTC 2017
Pages42
Paragraphs1204
Words2919

Comments