{"id":725,"date":"2008-01-04T19:56:57","date_gmt":"2008-01-05T02:56:57","guid":{"rendered":"http:\/\/members.crystalreportsbook.com\/crystal-reports-xi\/1710-sql-server-to-dataset\/"},"modified":"2008-01-04T19:56:57","modified_gmt":"2008-01-05T02:56:57","slug":"1710-sql-server-to-dataset","status":"publish","type":"post","link":"http:\/\/www.crystalreportsonlinetraining.com\/training\/1710-sql-server-to-dataset\/","title":{"rendered":"17.10 SQL Server to Dataset"},"content":{"rendered":"<h3>SQL Server<\/h3>\n<p>Connect to SQL Server using the SqlClient provider in the .NET Framework. Notice that the SQL statement in Listing 17-4 joins the Customers table and the Orders table by the CustomerId. This is much faster than creating two dataset objects and having the report join them on the client machine.<\/p>\n<p>         <code_Caption>Listing 17-4. Populating a dataset with a SQL Server table.<\/code_Caption><br \/>\n         <code>Private Sub FillDataset(ByVal myDataSet As DataSet)<\/code><br \/>\n         <code>Dim myConnectionString As String<\/code><br \/>\n         <code>Dim myDataAdapter As SqlClient.SqlDataAdapter<\/code><br \/>\n         <code>Dim SQL As String<\/code><br \/>\n         <code>SQL = \"SELECT Customers.*, Orders.* \" &amp; _<\/code><br \/>\n         <code>\"FROM Customers INNER JOIN Orders \" &amp; _<\/code><br \/>\n         <code>\"ON Customers.CustomerId = Orders.CustomerId\"<\/code><br \/>\n         <code>myConnectionString = \"Data Source=(local);UID=sa;pwd=pw;Database=Northwind\"<\/code><br \/>\n         <code>myDataAdapter = New SqlClient.SqlDataAdapter(mySQL, myConnectionString)<\/code><br \/>\n         <code>myDataAdapter.Fill(myDataSet, \"Customers\")<\/code><br \/>\n         <code>End Sub<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL Server Connect to SQL Server using the SqlClient provider in the .NET Framework. Notice that the SQL statement in Listing 17-4 joins the Customers table and the Orders table by the CustomerId. This is much faster than creating two dataset objects and having the report join them on the client machine. Listing 17-4. Populating [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37,2],"tags":[],"class_list":["post-725","post","type-post","status-publish","format-standard","hentry","category-chapter-17-dynamic-data-sources","category-crystal-reportsnet-2003","entry"],"_links":{"self":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/725","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/comments?post=725"}],"version-history":[{"count":0,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/725\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/media?parent=725"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/categories?post=725"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/tags?post=725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}