Click here to Skip to main content
15,891,902 members
Home / Discussions / Database
   

Database

 
AnswerRe: SQL 2005 ConnectionString Pin
itoleck13-Jan-06 4:57
itoleck13-Jan-06 4:57 
GeneralRe: SQL 2005 ConnectionString Pin
Paul Conrad14-Jan-06 10:02
professionalPaul Conrad14-Jan-06 10:02 
GeneralRe: SQL 2005 ConnectionString Pin
victor_ba8513-Jan-06 8:04
victor_ba8513-Jan-06 8:04 
GeneralRe: SQL 2005 ConnectionString Pin
jonathan1513-Jan-06 11:10
jonathan1513-Jan-06 11:10 
QuestionError in C# - not making sense Pin
TheJudeDude12-Jan-06 17:08
TheJudeDude12-Jan-06 17:08 
AnswerRe: Error in C# - not making sense Pin
Dave Kreskowiak13-Jan-06 5:28
mveDave Kreskowiak13-Jan-06 5:28 
GeneralRe: Error in C# - not making sense Pin
TheJudeDude13-Jan-06 12:23
TheJudeDude13-Jan-06 12:23 
GeneralRe: Error in C# - not making sense Pin
Dave Kreskowiak13-Jan-06 15:02
mveDave Kreskowiak13-Jan-06 15:02 
TheJudeDude wrote:
when I dragged and dropped an OleDbCommand on the form:


Mistake number one. It's always much better to write your own DB code than to rely on the designer to do it for you. You have MUCH greater control, easier to debug, and you won't end up making mistake number 2.

Mistake number 2. Just changing the SQL statement will not add the Parameter objects to the Parameters collection. OleDb doesn't use named parameters so you have to make sure that the parameter objects you add are done in the correct order as your SQL statement expects them.

You're missing something like this:
OleDbCommand cmd = new OleDbCommand("UPDATE tables SET Subtotal = ? WHERE (TableNumber = ?)", connectionString);
cmd.Parameters.Add("@Subtotal", OleDbType.Single, 4).Value = decSubtotal;
cmd.Parameters.Add("@TableNumber", OleDbType.Char, 10).Value = strTable;

This code is, of course, not guaranteed to work because there is so much more we don't know about your code, database field types and widths, ...


RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

GeneralRe: Error in C# - not making sense Pin
TheJudeDude13-Jan-06 15:38
TheJudeDude13-Jan-06 15:38 
QuestionOLTP and Reporting databases seperated? Pin
erdsah8812-Jan-06 10:27
erdsah8812-Jan-06 10:27 
AnswerRe: OLTP and Reporting databases seperated? Pin
Colin Angus Mackay12-Jan-06 11:06
Colin Angus Mackay12-Jan-06 11:06 
GeneralRe: OLTP and Reporting databases seperated? Pin
erdsah8812-Jan-06 21:15
erdsah8812-Jan-06 21:15 
QuestionCounts and CrossTabs Pin
john john mackey12-Jan-06 8:08
john john mackey12-Jan-06 8:08 
AnswerRe: Counts and CrossTabs Pin
Colin Angus Mackay12-Jan-06 11:04
Colin Angus Mackay12-Jan-06 11:04 
GeneralRe: Counts and CrossTabs Pin
john john mackey12-Jan-06 11:34
john john mackey12-Jan-06 11:34 
QuestionData from two using a third table Pin
gharry12-Jan-06 5:41
gharry12-Jan-06 5:41 
AnswerRe: Data from two using a third table Pin
Colin Angus Mackay12-Jan-06 11:00
Colin Angus Mackay12-Jan-06 11:00 
GeneralRe: Data from two using a third table Pin
gharry12-Jan-06 22:10
gharry12-Jan-06 22:10 
GeneralRe: Data from two using a third table Pin
gharry12-Jan-06 23:30
gharry12-Jan-06 23:30 
GeneralRe: Data from two using a third table Pin
Colin Angus Mackay12-Jan-06 23:44
Colin Angus Mackay12-Jan-06 23:44 
QuestionWhat is a named variable and why use it? Pin
kenn_rosie12-Jan-06 5:39
kenn_rosie12-Jan-06 5:39 
AnswerRe: What is a named variable and why use it? Pin
Colin Angus Mackay12-Jan-06 10:57
Colin Angus Mackay12-Jan-06 10:57 
QuestionDistinct in join - please help Pin
xaphod12-Jan-06 3:32
xaphod12-Jan-06 3:32 
AnswerRe: Distinct in join - please help Pin
Michael Potter12-Jan-06 4:55
Michael Potter12-Jan-06 4:55 
GeneralRe: Distinct in join - please help Pin
xaphod15-Jan-06 8:47
xaphod15-Jan-06 8:47 

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.