English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i have specified the sql query to connect to table..

SELECT propertydata.*, environdata.* FROM propertydata, environdata WHERE propertydata.farmerId = environdata.farmerid AND (propertydata.farmerId = ?)

how to give the parameter value (?)...

2007-02-22 00:46:32 · 2 answers · asked by joe 2 in Computers & Internet Programming & Design

2 answers

There are several ways, I'll assume propertydata.farmerId is an integer, you could do:

SELECT propertydata.*, environdata.* FROM propertydata, environdata WHERE propertydata.farmerId = environdata.farmerid AND (propertydata.farmerId = " & farmerID & ")"

And if you're using .net you can setup command parameters:

command.CommandText = "SELECT propertydata.*, environdata.* FROM propertydata, environdata WHERE propertydata.farmerId = environdata.farmerid AND (propertydata.farmerId = @FarmerID)"
command.Parameters.Add( "@FarmerID", SqlDbType.Int)
command.Parameters( "@FarmerID").Value = farmerID

2007-02-22 01:13:14 · answer #1 · answered by Pfo 7 · 1 0

It is very simple using SqlCommand class on vb
ex:
Dim SqlCmd As New SqlCommand("select * from employees where id = @ID", sqlconnection)
SqlCmd.Parameters.Add(New SqlParameter("@VAL", SqlDbType.NVarChar, (50), ParameterDirection.Input)).Value = TextBox1.Text

2007-02-22 11:10:58 · answer #2 · answered by MCAD 2 · 0 0

fedest.com, questions and answers