Advertisement
Guest User

cc0

a guest
Feb 21st, 2010
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.78 KB | None | 0 0
  1.         Dim con As SqlConnection = New SqlConnection("Data Source=localhost\SQLEXPRESS;Initial Catalog=DB;User ID=test;Password=test")
  2.         Dim da As New SqlDataAdapter
  3.         Dim cmd As New SqlCommand("getDates", con)
  4.         Dim par As New SqlParameter
  5.         Dim ds As New DataSet
  6.         da.SelectCommand = cmd
  7.         con.Open()
  8.         Try
  9.             cmd.CommandType = CommandType.StoredProcedure
  10.             cmd.Parameters.Add("@PlaceID", SqlDbType.Int)
  11.             cmd.Parameters("@PlaceID").Value = 39
  12.             da.Fill(ds)
  13.  
  14.         Finally
  15.             If cmd IsNot Nothing Then cmd.Dispose()
  16.             If con IsNot Nothing AndAlso con.State <> ConnectionState.Closed Then con.Close()
  17.         End Try
  18.  
  19.         messageLabel2.Text = ds.Tables(0).Rows.Count.ToString
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement