1 Previous Next 

SQL Server: parameters (simple sample)


This sample shows you the simplest way to use parameters. Change for OleDB (MS Access Jet) the SQLClient.SQLxxxx for OleDB.OleDBxxx

        Dim cmd As New SqlClient.SqlCommand("SELECT * FROM MyTable WHERE MyDate BETWEEN @BeginDate And @EndDate", ConnectionObject)
        cmd.Parameters.AddWithValue("@BeginDate"CDate(txtBeginDate.text))
        cmd.Parameters.AddWithValue("@EndDate"CDate(txtEndDate.text))



1 Previous Next