|
-
Jul 9th, 2003, 04:10 AM
#1
Thread Starter
Frenzied Member
Filter?
How can I use a filter in ASP.Net like ASP 3.0?
Code:
sqlVfPur = "SELECT * FROM diverse_faktorer"
set rs0 = myconn2.execute(sqlVfPur)
rs0.filter = "ID='1'"
VfPurArr(i) = rs0("Faktor")
This is my function in ASP.Net where I've uses oleDbDataReader.
Code:
Protected Sub MedieroersPris()
Dim strCn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("HpSap.xls") & ";" & _
"Extended Properties=Excel 8.0;"
'Dim strSql As String = "SELECT pris FROM [Sheet1$] WHERE Dim <= 323"
Dim strSql As String = "SELECT costing FROM [Sheet1$] WHERE Lgd=6 AND Material_type='St37' ORDER BY Dim ASC"
Dim objConnection As New OleDbConnection(strCn)
Dim objCommand As New OleDbCommand(strSql, objConnection)
Dim objDataReader As OleDbDataReader
objConnection.Open()
objDataReader = objCommand.ExecuteReader()
For i = 0 To objDataReader.FieldCount
Do While objDataReader.Read() = True
prisMedie(i) = CSng(objDataReader("costing"))
i += 1
Loop
Next
objDataReader.Close()
objConnection.Close()
End Sub
-
Jul 9th, 2003, 07:45 AM
#2
Hyperactive Member
A dataview has a rowfilter method. You could create a DV object and set it = to a datareader table. Then you can filter the DV.
I'll post an example later if you need one.
-
Jul 9th, 2003, 07:52 AM
#3
Thread Starter
Frenzied Member
Great, if you have an example it would be great (Lazy! )
-
Jul 9th, 2003, 09:25 AM
#4
Frenzied Member
VB Code:
Dim dv as New DataView(MyDataTable)
dv.RowFilter = "ID = " & id
-
Aug 14th, 2003, 04:01 AM
#5
Thread Starter
Frenzied Member
Do you have an example where you connect to an Access database and the filtering the selection?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|