|
Sascha Lefèvre wrote: you should never, ever use goto until you exactly understand why I write
Gets my vote!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Sascha Lefèvre wrote: Sidenote: In C#, local identifiers should be declared where you first need them, not all at the top of a method. I wonder where this habit comes from. I always declare vars at the top of the method.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I think it makes sense from a semantic point of view: You see a declaration and you know it's the first occurence of that identifier. It also saves some lines of code. Why do you prefer the top-declaration?
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
I think it may have come from the days when it was possible to declare a variable multiple times, VB5 allowed that and possibly 6, my milk languages. I think I have broken most of the old habits, annoying to realise some are still in use.
I do recall declaring and enum called Date with a value of 2, screwed up so many things. It was a long time ago!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Int a = -1;
Int hhhhhh = 0;
While (a <= 0)
{
Console.write("tell me " + hhhhhh.ToString() + "nd number ");
a = int.Parse(Console.ReadLine());
hhhhhh++;
}
Console.WriteLine("homework complete");
modified 3-Apr-16 13:42pm.
|
|
|
|
|
I haven't used any
Console.WriteLine to display "Input string was not in a correct format" . I am trying to get data from database and save it in a double 2D array. One row in each array entry. This is my code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
namespace Outliers2010_Console
{
class Program
{
static void Main(string[] args)
{
try
{
double[][] rawData = new double[20][];
string con = @"Data Source=Kitty-PC\SQLEXPRESS;Initial Catalog=kitty12;Integrated Security=True";
SqlConnection sql = new SqlConnection(con);
string cms = "SELECT TOP 20 * FROM churn_or";
SqlCommand cmd = new SqlCommand(cms,sql);
sql.Open();
SqlDataReader dt = cmd.ExecuteReader();
int i = 0;
if (dt.HasRows)
{
Console.WriteLine("datareader has rows");
while (dt.Read())
{
Console.WriteLine("read from dt");
rawData[i] = new double[] {Convert.ToDouble (dt[0]), Convert.ToDouble(dt[1]), Convert.ToDouble(dt[2]), Convert.ToDouble(dt[3]), Convert.ToDouble(dt[4]), Convert.ToDouble(dt[5]), Convert.ToDouble(dt[6]), Convert.ToDouble(dt[7]), Convert.ToDouble(dt[8]), Convert.ToDouble(dt[9]), Convert.ToDouble(dt[10]), Convert.ToDouble(dt[11]), Convert.ToDouble(dt[12]), Convert.ToDouble(dt[13]), Convert.ToDouble(dt[14]), Convert.ToDouble(dt[15]), Convert.ToDouble(dt[16]), Convert.ToDouble(dt[17]), Convert.ToDouble(dt[18]), Convert.ToDouble(dt[19]), Convert.ToDouble(dt[20]), Convert.ToDouble(dt[21]), Convert.ToDouble(dt[22]), Convert.ToDouble(dt[23]), Convert.ToDouble(dt[24]), Convert.ToDouble(dt[25]), Convert.ToDouble(dt[26]), Convert.ToDouble(dt[27]), Convert.ToDouble(dt[28]), Convert.ToDouble(dt[29]), Convert.ToDouble(dt[30]), Convert.ToDouble(dt[31]), Convert.ToDouble(dt[32])};
Console.WriteLine(rawData[i]);
i++;
}
}
sql.Close();
}
catch()
{}
}
}
}
I am not getting any error nor exception nor even a message, but in output instead of getting value of rawData which I need to be printed. I am getting "Input string was not in a correct format" . I have extensively googled and even tried the suggestions but all are talking about exceptions and errors which are not solving my issue. haven't found any content like that
modified 2-Apr-16 8:20am.
|
|
|
|
|
Use the debugger.
Put a breakpoint on the line
Console.WriteLine("read from dt");
and run your app.
When it hits the line, it will stop and let you look at exactly what is happening.
Look at each of the values in your DataReader - at least one of them is not a string representation of a double value.
We can't do that for you: we don't have your data!
BTW: Two things.
1) You should use a using block for SqlConnections, SqlCommands, and so forth to ensure they are correctly disposed.
2) Unless you specify a sort order in your SQL query via a ORDER BY clause, SQL is at liberty to return rows in any order it feels like - so you may not get the same values in two consecutive runs. Always specify the order if you want to return specific rows!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I am working on a C# project which is related to Write/Read RFID NXP tag. Reader model is Feig obid i-scan MR102. This is USB device. They provided SDK. I can read default serial number of NXP tag with this SDK. My problem is, I need to Write ISBN of a book in NXP tag and Turn security ON when the book indoor into library. When the book will be issued, I need to Read the ISBN of this book and Turn security OFF. I am attaching the SDK, if you know how to do this, please give me solution. Thanks.
SDK : <a href="https://drive.google.com/file/d/0B5vXfWlYNNbVVkxDWnEyLTBuZEU/view?usp=sharing">ID_ISC.SDK.NET_V04.06.10.zip - Google Drive</a>
|
|
|
|
|
You should talk to the people who created it - the device and the API - they should provide technical support and will know more about their product than we will. If they don't, then find another supplier and demand your money back!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I asked them, they told me i will find read/write functions in sdk, but i did not get it from there. Thanks for your reply.
|
|
|
|
|
Well, go back to them and ask "Where?" and "How do I use it?"
They know their product - it's unlikely that anyone here is going to, or at least anyone that is going to see this and reply in a "reasonable time".
Seriously - if their technical support is just "it's in the API" with no further support documents or assistance, I'd be looking to my money back and a new supplier, as they clearly don't care...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
You expect people to root around in an SDK without even a hint of who the vendor is?
Did you even bother to unzip it?
|
|
|
|
|
I really don't understand, why you are telling this. Vendor is, Feig. It's a german company.
|
|
|
|
|
Sorry .. my mistake ... I'll look some more.
|
|
|
|
|
Does not matter. If you have any idea, please help me. Thanks.
|
|
|
|
|
|
Gerry Schmitz wrote: You can write an "ID" to the device; that would be your ISBN, I presume.
Can you give me an example, how to read/write string in nxp tag?
Securiy READ/WRITE problem is solved, and I very greatfull to you for this.
Thanks in advance.
|
|
|
|
|
There is a "write ID" command; whether it meets your requirements is for you to determine.
I suspect you are probably more interested in reading and writing to the device's "user area".
The "user area" depends on the device type (again, your domain); e.g. (from the link I sent).
Chip ID: 1h = 00000001b (Bit 47 - 40 of UID)
Memory organization: 32 x 4 Byte = 1kBit
Number of blocks 32 (user area: 0 – 27)
Block size 4 byte
0x23 Read Multiple Blocks
0x24 Write Multiple Blocks<br />
So; crack open the SDK and refer to "reading and writing" from / to the "user area".
|
|
|
|
|
How would you make a computer generate a response based on a question asked. and how would this be generated
|
|
|
|
|
I'd get the computer to email the question to a human being and post his response...
Sorry, but that's far, far too broad a question for us to answer!
What have you tried?
Where are you stuck?
What help do you need?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
And what does this have to do with this forum?
This space for rent
|
|
|
|
|
Just generate a random answer.
Sort of like the "Magic 8-Ball" ...
Question: "Will I be happy?"
Answer: "Outlook good".
(Kept them spell-bound for hours back when).
|
|
|
|
|
Hello,
I am new to C#. I have an application which has easy interface for File search. I want to trigger that application using Ctrl+F only when Windows Explorer is active.
Is it possible in .net ?
Is there any available example codes ?
Please help.
|
|
|
|
|