B
Bob
Hi,
I made a webservice for fetching data from a database. It works good.
Now i would like to add a parameter to the sql command. The user should
enter a value (pcnr) before the
data is fetched. I tried to add a texbox but it doesn't work.
How can i do that?
Thanks
Bob
My code:
......
<WebMethod()> _
Public Function pcinfo() As DataSet
Dim oConnection As OleDbConnection
Dim pcnr As Integer
Dim d As OleDbDataAdapter
oConnection = New OleDbConnection()
Dim sql As String
Dim ds As New DataSet
Dim tb As New TextBox
pcnr= Convert.ToInt16(tb.Text)
sql = "SELECT * from pc where pcnr=" & pcnr & ";"
Dim sConnectionString As String
sConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source
= c:\mytable.mdb"
d = New OleDbDataAdapter(sql, sConnectionString)
d.Fill(ds)
Return ds
End Function
.....
I made a webservice for fetching data from a database. It works good.
Now i would like to add a parameter to the sql command. The user should
enter a value (pcnr) before the
data is fetched. I tried to add a texbox but it doesn't work.
How can i do that?
Thanks
Bob
My code:
......
<WebMethod()> _
Public Function pcinfo() As DataSet
Dim oConnection As OleDbConnection
Dim pcnr As Integer
Dim d As OleDbDataAdapter
oConnection = New OleDbConnection()
Dim sql As String
Dim ds As New DataSet
Dim tb As New TextBox
pcnr= Convert.ToInt16(tb.Text)
sql = "SELECT * from pc where pcnr=" & pcnr & ";"
Dim sConnectionString As String
sConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source
= c:\mytable.mdb"
d = New OleDbDataAdapter(sql, sConnectionString)
d.Fill(ds)
Return ds
End Function
.....