Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
GeneralRe: NHibernate Pin
peshawarcoder11-Dec-06 2:12
peshawarcoder11-Dec-06 2:12 
QuestionDatabase Question [modified] Pin
mfcuser8-Dec-06 7:44
mfcuser8-Dec-06 7:44 
AnswerRe: Database Question Pin
User 17164929-Dec-06 4:55
professionalUser 17164929-Dec-06 4:55 
QuestionRestaurant POS Database Question (long) Pin
jeweladdict8-Dec-06 7:29
jeweladdict8-Dec-06 7:29 
AnswerRe: Restaurant POS Database Question (long) Pin
karam chandrabose8-Dec-06 10:06
karam chandrabose8-Dec-06 10:06 
AnswerRe: Restaurant POS Database Question (long) Pin
Not Active8-Dec-06 14:35
mentorNot Active8-Dec-06 14:35 
QuestionWhat is wrong Pin
CodeItWell8-Dec-06 7:16
CodeItWell8-Dec-06 7:16 
AnswerRe: What is wrong Pin
Andrew Rissing8-Dec-06 7:58
Andrew Rissing8-Dec-06 7:58 
We'll a few things..here's a start:

1. The line "OleDbDataAdapter sql = new OleDbDataAdapter ..." is unused and can be removed.

2. You're not validating the value of your textboxes. So, here's a list of all the problems you're going to have from that:

a) SQL injection
b) A single tick mark could cause your query to fail.
c) Invalid types could also cause your query to fail.

3. Your "@" is unneccessary if you're trying to modify how the compiler is treating the C# string immediately following.

4. Opening/closing of your connection should occur as close together as possible. So, you should move your open just before your call ExecuteNonQuery.

5. Why are you closing the connection right after your creation of the OleDbDataAdapter? It's unneccessary.

6. And the one million dollar answer that you wanted, your second set of tick marks (') for each value should be commas rather than tick marks.

For future cases, I would suggest looking at the string you're building up (if you indeed choose to keep building dynamic SQL like that) in the debugger. I would highly suggest either creating a parameterized SQL string or a stored procedure (my recommendation) for such cases.

Good luck.
QuestionNHibernate Pin
peshawarcoder8-Dec-06 6:41
peshawarcoder8-Dec-06 6:41 
AnswerRe: NHibernate Pin
Judah Gabriel Himango8-Dec-06 6:54
sponsorJudah Gabriel Himango8-Dec-06 6:54 
QuestionDisplay Datagrid Decimal to 2 places Pin
jeweladdict8-Dec-06 5:47
jeweladdict8-Dec-06 5:47 
AnswerRe: Display Datagrid Decimal to 2 places Pin
ednrgc8-Dec-06 5:58
ednrgc8-Dec-06 5:58 
GeneralRe: Display Datagrid Decimal to 2 places Pin
jeweladdict8-Dec-06 6:49
jeweladdict8-Dec-06 6:49 
GeneralRe: Display Datagrid Decimal to 2 places Pin
ednrgc8-Dec-06 6:59
ednrgc8-Dec-06 6:59 
QuestionNeed help with Regex Pin
zaboboa8-Dec-06 5:08
zaboboa8-Dec-06 5:08 
AnswerRe: Need help with Regex Pin
ednrgc8-Dec-06 7:04
ednrgc8-Dec-06 7:04 
QuestionInsert javascript into IE Address bar Pin
PhrankBooth8-Dec-06 4:39
PhrankBooth8-Dec-06 4:39 
AnswerRe: Insert javascript into IE Address bar Pin
ednrgc8-Dec-06 7:06
ednrgc8-Dec-06 7:06 
QuestionHow to Use Sql Transactions With DataRow ? Pin
hdv2128-Dec-06 4:17
hdv2128-Dec-06 4:17 
AnswerRe: How to Use Sql Transactions With DataRow ? Pin
Colin Angus Mackay8-Dec-06 4:41
Colin Angus Mackay8-Dec-06 4:41 
QuestionNetwork Credentials for domain user Pin
vineas8-Dec-06 4:15
vineas8-Dec-06 4:15 
QuestionTreeview and jump to node Pin
Saamir8-Dec-06 4:13
Saamir8-Dec-06 4:13 
AnswerRe: Treeview and jump to node Pin
Pete O'Hanlon8-Dec-06 5:01
mvePete O'Hanlon8-Dec-06 5:01 
AnswerRe: Treeview and jump to node Pin
Not Active8-Dec-06 5:07
mentorNot Active8-Dec-06 5:07 
QuestionRe: Treeview and jump to node Pin
Saamir8-Dec-06 5:55
Saamir8-Dec-06 5:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.