Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim gcConnStr As String gcConnStr = "Server=" & Me.txt_Server.Text.Trim() & ";uid=ctore;pwd=mypassword;database=CTOREDEV" Dim da As New SqlClient.SqlDataAdapter() Dim ds As New Data.DataSet() Dim remoteSql As System.Data.SqlClient.SqlConnection remoteSql = New System.Data.SqlClient.SqlConnection(gcConnStr) Try ' Open the connection remoteSql.Open() ' Create the command object Dim oCommand As New System.Data.SqlClient.SqlCommand ' Set the command type and stored procedure to exec oCommand.CommandText = "ppc_PhysicianIndSch" oCommand.CommandType = CommandType.StoredProcedure ' Add the two paramters to the command object Dim oParm1 As New System.Data.SqlClient.SqlParameter oParm1.Value = "11/01/2004 00:00:01" oParm1.Direction = ParameterDirection.Input oParm1.ParameterName = "@ltQueryFrom" oParm1.DbType = DbType.DateTime oCommand.Parameters.Add(oParm1) Dim oParm2 As New System.Data.SqlClient.SqlParameter oParm2.Value = "11/02/2004 23:59:59" oParm2.Direction = ParameterDirection.Input oParm2.ParameterName = "@ltQueryTo" oParm2.DbType = DbType.DateTime oCommand.Parameters.Add(oParm2) da.SelectCommand = oCommand Try da.Fill(ds, "SCH") Catch ex As Exception MsgBox(ex.Message) 'Error Message: Could Not Find Resouce Assembly remoteSql.Close() Return End Try Dim lnCount As Integer lnCount = Me.BindingContext(ds, "sch").Count MsgBox("Count=" & lnCount.ToString) remoteSql.Close() Catch ex As System.Data.SqlClient.SqlException MsgBox("Unable to connect with the remote system database - " & ex.Message, MsgBoxStyle.Information, "Can't Connect") End Try End Sub