15,901,373 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Geoff Williams (Top 16 by date)
Geoff Williams
19-Sep-11 12:02pm
View
The original query was correct. Using OLE, you need to use the '<bold>?/<bold>' character as place holders for the data values.
<pre lang="vb">sql = "SELECT * FROM tblContacts where Name=? and City=?"
da = New OleDb.OleDbDataAdapter(sql, con)
da.SelectCommand.Parameters.AddWithValue("@name", name)
da.SelectCommand.Parameters.AddWithValue("@city", city)</pre>
Geoff Williams
20-Mar-11 13:39pm
View
To be really safe - or at least safe as you can be when using macros - you should wrap the macro definition in brackets as well i.e.
#define AREA(a) ((a) * (a))
Geoff Williams
10-Jan-11 13:14pm
View
If you are looking to use only the date values of your EngageDate field then you could change the last part of your query from
AND EngageDate = @EngageDate
to
AND YEAR(EngageDate) = YEAR(@EngageDate) AND MONTH(EngageDate) = MONTH(@EngageDate) AND DAY(EngageDate) = DAY(@EngageDate)
Geoff Williams
28-Dec-10 12:26pm
View
Deleted
This is of limited use - it only works where the password is a 32-bit integer. It is far better to use parameterised queries as they are of more general use.
Geoff Williams
29-Nov-10 13:23pm
View
Have you tried using a lower colour resolution e.g. Imaging.PixelFormat.Format24bppRgb?
Geoff Williams
29-Nov-10 11:25am
View
If you are using
path = "C:\\Documents and Settings\\Nano\\My Documents\\My Pictures\\my2.jpg"
then change it to
path = "C:\Documents and Settings\Nano\My Documents\My Pictures\my2.jpg"
as you are using VB.NET.
Geoff Williams
18-Nov-10 6:00am
View
In the original code sample (which seems to have been removed), that is exactly what it was trying to do!
Geoff Williams
12-Nov-10 7:45am
View
You're welcome
Geoff Williams
12-Nov-10 7:31am
View
In your assignment to TextBox1.Text, you are missing the index to the Rows collection:
TextBox1.Text = dt.Rows(0).Item(0).ToString()
Geoff Williams
12-Nov-10 7:02am
View
You need to modify your query string.
Dim StrQuery as String = "SELECT * FROM Clarus WHERE(Product = '" & CType(ComboBox1.SelectedItem, DataRowView).Item("Product") & "')"
When you bind a DataSet to a ComboBox, you don't bind a simple list of items, you bind a set of DataRowView items.
Geoff Williams
12-Nov-10 6:09am
View
Is that what you are expecting?
Geoff Williams
12-Nov-10 5:37am
View
It should not affect anything.
It would be worth checking what the contents of your Select query are e.g.
Dim StrQuery = "SELECT * FROM Clarus WHERE (Product = '" & ComboBox1.SelectedItem.ToString() & "')"
MsgBox(strQuery)
Dim DA As New OleDbDataAdapter(strQuery, conn)
to check what you are passing to the database.
Geoff Williams
12-Nov-10 5:16am
View
Did you remember to add the single-quote characters to the Select string in your ComboBox event handler?
Geoff Williams
12-Nov-10 5:01am
View
Then it looks like the problem lies with the list of items you have in your combobox.
Geoff Williams
12-Nov-10 4:43am
View
Then presumably the Select query is not returning any records. You'll need to replace the line
TextBox1.Text = dt.Rows.Item(0).ToString()
with something like
If (dt.Rows.Count > 0) Then
TextBox1.Text = dt.Rows.Item(0).ToString()
Else
TextBox1.Text = String.Empty ' or an appropriate message
End If
Geoff Williams
11-Nov-10 10:57am
View
Have you changed the assignment to TextBox1.Text to
TextBox1.Text = dt.Rows.Item(0).ToString()
as mentioned in one of the earlier answers?
Show More