Month: June 2006

June 19, 2006

using System;using System.Collections.Generic;using System.Text;using System.Data;using System.Data.SqlClient;namespace SqlParametersDemo{   class Program   {      static string connectionString = “server=local;database=yourdatabase;userid=youruserid;password=yourpassword;”;      static void Main(string[] args)      {         ShowDemo();         Console.ReadLine();      }      static void ShowDemo()      {         SimpleQuery();         SimpleParameterQuery();         SqlParameterQuery();      }      /// <summary>      /// This function demonstrates how to generate a DataTable using a simple sql statement      /// </summary>      private static void SimpleQuery()      {         string sqlStatement = “select * from users;”;         DataTable table = new DataTable();         SqlDataAdapter adapter = new SqlDataAdapter(sqlStatement, connectionString);         adapter.Fill(table);         PrintHeader(“Simple Query.”);         IterateThruDataTableRowsAndColumns(table);      }      /// <summary>      /// This function demonstrates […]

Continue Reading
June 7, 2006

There are alot of ways to accomplish this. The simplest one is to use the sp_databases procedure. Here’s some example that uses this stored procedure in conjunction with ADO.NET to consume the returned data. The sp_databases procedure lists databases that either reside in an instance of the SQL Server 2000/2005 Database Engine or are accessible […]

Continue Reading