Click here to Skip to main content
15,884,425 members
Home / Discussions / C#
   

C#

 
GeneralRe: Interfaces with code in them Pin
Gerry Schmitz20-Aug-21 6:48
mveGerry Schmitz20-Aug-21 6:48 
Questionthere I thought the days of CreateParams were over ... observation (tip ?) Pin
BillWoodruff17-Aug-21 12:34
professionalBillWoodruff17-Aug-21 12:34 
AnswerRe: there I thought the days of CreateParams were over ... observation (tip ?) Pin
OriginalGriff19-Aug-21 9:02
mveOriginalGriff19-Aug-21 9:02 
GeneralRe: there I thought the days of CreateParams were over ... observation (tip ?) Pin
Richard Andrew x6419-Aug-21 9:26
professionalRichard Andrew x6419-Aug-21 9:26 
GeneralRe: there I thought the days of CreateParams were over ... observation (tip ?) Pin
BillWoodruff19-Aug-21 10:46
professionalBillWoodruff19-Aug-21 10:46 
QuestionSystem.IndexOutOfRangeException Pin
ProgrammerT216-Aug-21 23:36
ProgrammerT216-Aug-21 23:36 
AnswerRe: System.IndexOutOfRangeException Pin
Ralf Meier16-Aug-21 23:43
mveRalf Meier16-Aug-21 23:43 
AnswerRe: System.IndexOutOfRangeException Pin
OriginalGriff17-Aug-21 0:06
mveOriginalGriff17-Aug-21 0:06 
The error says that there are either no rows or no columns in your Rows collection:
And why that might be is not something we can help with: we have no access to your database class, or its readData method, or the data behind it.

So, it's going to be up to you.
Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. If you don't know how to use it then a quick Google for "Visual Studio debugger" should give you the info you need.

Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.

Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!

But you do have to ask yourself why you are going at this in such as "round the houses" approach: creating and filling a DataTable for a single numeric value looks rather silly, when every SQL based system I have ever met has supported an ExecuteScalar method to query and return a single value ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!

QuestionHow Linq determine the index of a list item? Pin
Alex Dunlop16-Aug-21 22:57
Alex Dunlop16-Aug-21 22:57 
AnswerRe: How Linq determine the index of a list item? Pin
Richard Deeming16-Aug-21 23:09
mveRichard Deeming16-Aug-21 23:09 
QuestionC# interacting with Excel Pin
Ismael Oliveira 202116-Aug-21 13:15
Ismael Oliveira 202116-Aug-21 13:15 
AnswerRe: C# interacting with Excel Pin
Richard Deeming16-Aug-21 21:36
mveRichard Deeming16-Aug-21 21:36 
GeneralRe: C# interacting with Excel Pin
Ismael Oliveira 202124-Aug-21 12:46
Ismael Oliveira 202124-Aug-21 12:46 
AnswerRe: C# interacting with Excel Pin
Richard MacCutchan16-Aug-21 21:42
mveRichard MacCutchan16-Aug-21 21:42 
AnswerRe: C# interacting with Excel Pin
SpiveyC#7-Sep-21 1:44
SpiveyC#7-Sep-21 1:44 
QuestionHow to merge cells in Excel using C# Pin
Ismael Oliveira 202112-Aug-21 12:43
Ismael Oliveira 202112-Aug-21 12:43 
AnswerRe: How to merge cells in Excel using C# Pin
Richard MacCutchan12-Aug-21 21:35
mveRichard MacCutchan12-Aug-21 21:35 
GeneralRe: How to merge cells in Excel using C# Pin
Ismael Oliveira 202113-Aug-21 13:45
Ismael Oliveira 202113-Aug-21 13:45 
GeneralRe: How to merge cells in Excel using C# Pin
Richard MacCutchan13-Aug-21 21:44
mveRichard MacCutchan13-Aug-21 21:44 
GeneralRe: How to merge cells in Excel using C# Pin
Ismael Oliveira 202114-Aug-21 12:46
Ismael Oliveira 202114-Aug-21 12:46 
GeneralRe: How to merge cells in Excel using C# Pin
Richard MacCutchan14-Aug-21 21:09
mveRichard MacCutchan14-Aug-21 21:09 
QuestionPassing a variable from an string to a For loop Pin
Alex Dunlop11-Aug-21 23:55
Alex Dunlop11-Aug-21 23:55 
AnswerRe: Passing a variable from an string to a For loop Pin
Pete O'Hanlon12-Aug-21 2:28
mvePete O'Hanlon12-Aug-21 2:28 
GeneralRe: Passing a variable from an string to a For loop Pin
harold aptroot12-Aug-21 2:42
harold aptroot12-Aug-21 2:42 
AnswerRe: Passing a variable from an string to a For loop Pin
Richard Deeming12-Aug-21 2:48
mveRichard Deeming12-Aug-21 2:48 

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.