Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
What would cause this error in my C# statement?
It doesn't like "Category." If I remove all the code to handle the category column, it works fine. I'm working in Visual Studio 2005, and I'm stumped...???
MY CODE:
OleDbConnection myConn;
myConn = new OleDbConnection("Provider=Advantage OLE DB Provider;Data Source=\\\\server123\\ m \\dst \\plx_data\\ planfaxsystem.add; User Id=XXXXXXXXXX; Password=XXXXXXXXXX;");
myConn.Open();
string morningStar = "MorningStar";
string sql2 = String.Format("INSERT INTO PERFORMANCE_TABLE(SecurityName, Ticker, Cusip, Category) VALUES ('{0}', '{1}', '{2}', '{3}')", fundName, ticker, cusip, category);
OleDbCommand cmd = new OleDbCommand(sql2, myConn);
cmd.ExecuteNonQuery(); // ** CRASHES HERE **
if (myConn != null && myConn.State == ConnectionState.Open)
{
myConn.Close();
}
ERROR MESSAGE:
Error 7200: AQE Error: State = 01004; NativeError = 2102; [Extended Systems][Advantage SQL Engine]Data truncated INSERT INTO SYSTEM_PERFORMANCE (SecurityName, Ticker, Cusip, Category) VALUES ('Newton Balanced', 'STASX', '001285400', 'Moderate Allocation')
Sorry, I had the table name wrong in the above error:
ERROR MESSAGE:
Error 7200: AQE Error: State = 01004; NativeError = 2102; [Extended Systems][Advantage SQL Engine]Data truncated INSERT INTO PERFORMANCE_TABLE (SecurityName, Ticker, Cusip, Category) VALUES ('Newton Balanced', 'STASX', '001285400', 'Moderate Allocation')
4 Answers
- David KLv 41 decade agoFavorite Answer
check the types on the columns you are inserting into. It seems the insert is failing because it was cause some of your data to be truncated. (say its a varchar(50) and you are inserting 55 characters)
- Me MLv 51 decade ago
Is Cusip supposed to be an integer or a varchar? With the single-quotation marks around 001285400 in the SQL statement, I believe the sql server will interpret that as characters, instead of a number.
- Anonymous4 years ago
nicely, have you ever tried defining a constructor for the classification, whether it does no longer something. i'm no longer in front of a g++ compiler on the 2d to attempt it out. I did whether attempt it on a GCC compiler (utilising codeblocks), and it labored completely high quality without compilation blunders or informational messages. I did whether could remark out the line that did 'std::cin.forget approximately approximately...', because of the fact I wasn't particular what code became there. in case you % me to attempt the code returned utilising each and all of the code you have for it, in basic terms positioned some areas interior the template call which you have been making 'std::numeric_limits<std:...'.
- Aadil PrabhakarLv 41 decade ago
Have you tried renaming the column Category to cat or cate or something because the error as per you r question is on the CATEGORY column.