•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 427,100 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,289 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 366 | Replies: 3
![]() |
•
•
Join Date: Jul 2008
Posts: 26
Reputation:
Rep Power: 1
Solved Threads: 1
Using VB 2008, I am stumped. I have a fillby and getdataby table adapter query that does a SELECT COUNT from FILENAME where fieldname = textbox and I want to use the number of rows returned, but can't figure out how to reference it. This seems so simple, but I have been Googling this for nearly two hours and can't figure it out. Any help would be appreciated.
Thanks,
Bill P.
Thanks,
Bill P.
•
•
Join Date: Nov 2007
Location: � Jogja �
Posts: 2,585
Reputation:
Rep Power: 11
Solved Threads: 235
vb Syntax (Toggle Plain Text)
"Select Count (*) from FILENAME where fieldname = '" & Trim(textbox.text) & "' "
Last edited by Jx_Man : Jul 19th, 2008 at 12:39 pm.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
•
•
Join Date: Jul 2008
Posts: 26
Reputation:
Rep Power: 1
Solved Threads: 1
Thanks for your reply. That is basically what I am doing. My problem is that I want to use the value of COUNT in code, i.e.
How do I refence it?
Thanks again,
Bill P.
if count = 0 then ' do something end if
How do I refence it?
Thanks again,
Bill P.
•
•
Join Date: Nov 2007
Location: � Jogja �
Posts: 2,585
Reputation:
Rep Power: 11
Solved Threads: 235
im used sql server (you can modified this code with other database)
VB.Net Syntax (Toggle Plain Text)
Dim myReader As SqlDataReader conn = GetConnect() conn.Open() Dim temp As String Try Dim sql As String = "Select Count (*) AS 'KODE' from FILENAME where fieldname = '" & Trim(textbox.text) & "'" Dim comm As SqlCommand = New SqlCommand(sql, conn) myReader = comm.ExecuteReader If myReader.HasRows Then While myReader.Read() temp = myReader.Item("KODE") End While End If myReader.Close() Catch ex As Exception End Try conn.Close() If temp = 0 then 'Do Something End If
Last edited by Jx_Man : Jul 19th, 2008 at 1:01 pm.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
![]() |
•
•
•
•
•
•
•
•
DaniWeb VB.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the VB.NET Forum
- Previous Thread: my first website in dotnet
- Next Thread: VB Error's I don't know



Linear Mode