Advertisement
Guest User

cc0

a guest
Feb 21st, 2010
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.         Dim sr As New JavaScriptSerializer
  7.         Dim dt As New DataTable
  8.  
  9.         da.SelectCommand = cmd
  10.         con.Open()
  11.  
  12.         Try
  13.             cmd.CommandType = CommandType.StoredProcedure
  14.             cmd.Parameters.Add("@PlaceID", SqlDbType.Int)
  15.             cmd.Parameters("@PlaceID").Value = 39
  16.             da.Fill(ds)
  17.  
  18.         Finally
  19.             If cmd IsNot Nothing Then cmd.Dispose()
  20.             If con IsNot Nothing AndAlso con.State <> ConnectionState.Closed Then con.Close()
  21.         End Try
  22.  
  23.         dt = ds.Tables(0)
  24.         Dim json As New String(sr.Serialize(dt))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement