Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function getCustomer()
- Dim sConnectionString As String = ConfigurationManager.AppSettings("dbTrainingDSN")
- Dim cnSqlConnection1 As New SqlConnection(sConnectionString)
- 'Create a command for SQL. In this case we're calling the getCustomer stored Procedure.
- Dim cmdGetCustomer As New SqlCommand
- cmdGetCustomer.CommandText = "Pr_GetCustomer"
- cmdGetCustomer.CommandType = CommandType.StoredProcedure
- cmdGetCustomer.Connection = cnSqlConnection1
- 'Open connection
- cnSqlConnection1.Open()
- 'Select command and fill data using DA
- Dim daCustomer As System.Data.SqlClient.SqlDataAdapter
- Dim dtCustomer As New DataTable
- Try
- daCustomer = New System.Data.SqlClient.SqlDataAdapter
- daCustomer.SelectCommand = cmdGetCustomer
- daCustomer.Fill(dtCustomer)
- Catch Err As System.Exception
- End Try
- 'Close connection and get the tables
- cnSqlConnection1.Close()
- Return dtCustomer
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement