EvaluateException at Select-Funktion
-
Hi, I´d like to select DataRows with an Id and a Date, but I always get the following Error-Message: Cannot perform '=' operation on System.DateTime and System.String. Here my Code:
string BehID = data1.Behandlungen.Rows.Count.ToString();
string datum = microsim1["picdate"].ToString();
DataRow[] VerlaufDatum = data1.Verlauf.Select("BehandlungsID=" + BehID + " AND Datum= '" + datum + "'");It worked perfectly witch Visual Studio 2003, but with Visual Studio 2008 I always get this Exception :( thanks for your help.
-
Hi, I´d like to select DataRows with an Id and a Date, but I always get the following Error-Message: Cannot perform '=' operation on System.DateTime and System.String. Here my Code:
string BehID = data1.Behandlungen.Rows.Count.ToString();
string datum = microsim1["picdate"].ToString();
DataRow[] VerlaufDatum = data1.Verlauf.Select("BehandlungsID=" + BehID + " AND Datum= '" + datum + "'");It worked perfectly witch Visual Studio 2003, but with Visual Studio 2008 I always get this Exception :( thanks for your help.
im suprised it worked in any version youor trying to compare a string to a dateTime which clearly is not the same type As the BehID is unique why use the datum value at all?
If only MySelf.Visible was more than just a getter... A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
-
Hi, I´d like to select DataRows with an Id and a Date, but I always get the following Error-Message: Cannot perform '=' operation on System.DateTime and System.String. Here my Code:
string BehID = data1.Behandlungen.Rows.Count.ToString();
string datum = microsim1["picdate"].ToString();
DataRow[] VerlaufDatum = data1.Verlauf.Select("BehandlungsID=" + BehID + " AND Datum= '" + datum + "'");It worked perfectly witch Visual Studio 2003, but with Visual Studio 2008 I always get this Exception :( thanks for your help.
Hi, Try to create a DateTime object from
datum
, to see if you have a valid data format in that string. Calin
-
Hi, I´d like to select DataRows with an Id and a Date, but I always get the following Error-Message: Cannot perform '=' operation on System.DateTime and System.String. Here my Code:
string BehID = data1.Behandlungen.Rows.Count.ToString();
string datum = microsim1["picdate"].ToString();
DataRow[] VerlaufDatum = data1.Verlauf.Select("BehandlungsID=" + BehID + " AND Datum= '" + datum + "'");It worked perfectly witch Visual Studio 2003, but with Visual Studio 2008 I always get this Exception :( thanks for your help.
You need to convert one or both sides of your statement so that they are both the same data type. A string type and a datetime type are incompatible, so find a way to collect the datetime information contained in your string explicitly and use
DateTime.Parse
to make it compatible. -
Hi, I´d like to select DataRows with an Id and a Date, but I always get the following Error-Message: Cannot perform '=' operation on System.DateTime and System.String. Here my Code:
string BehID = data1.Behandlungen.Rows.Count.ToString();
string datum = microsim1["picdate"].ToString();
DataRow[] VerlaufDatum = data1.Verlauf.Select("BehandlungsID=" + BehID + " AND Datum= '" + datum + "'");It worked perfectly witch Visual Studio 2003, but with Visual Studio 2008 I always get this Exception :( thanks for your help.
Also, you should try to format your date as following:
"#" + dt.Month + "/" + dt.Day + "/" + dt.Year + "#"
Calin -
Hi, Try to create a DateTime object from
datum
, to see if you have a valid data format in that string. Calin
I already tried to create a DateTime Object from
datum
and the Cast worked perfectly, but there occurs the same Exception when I edit the Code as follows:
DataRow[] VerlaufDatum = data1.Verlauf.Select("BehandlungsID=" + BehID + " AND Datum= '" + Convert.ToDateTime(datum) + "'");
I think it has something to do with the '=' Operator, but I don´t know what´s wrong with it :(
-
I already tried to create a DateTime Object from
datum
and the Cast worked perfectly, but there occurs the same Exception when I edit the Code as follows:
DataRow[] VerlaufDatum = data1.Verlauf.Select("BehandlungsID=" + BehID + " AND Datum= '" + Convert.ToDateTime(datum) + "'");
I think it has something to do with the '=' Operator, but I don´t know what´s wrong with it :(
Try by formatting the date and pass this string: "#" + dt.Month + "/" + dt.Day + "/" + dt.Year + "#" Calin
-
Also, you should try to format your date as following:
"#" + dt.Month + "/" + dt.Day + "/" + dt.Year + "#"
Calin -
I'm glad, no problem. Calin
-
Also, you should try to format your date as following:
"#" + dt.Month + "/" + dt.Day + "/" + dt.Year + "#"
CalinAh, I love being reminded of Jet. Now we know where they DataSet team got there start.
Need custom software developed? I do C# development and consulting all over the United States.
If you don't ask questions the answers won't stand in your way.
Doing a job is like selecting a mule, you can't choose just the front half xor the back half so when you ask me to do a job don't expect me to do it half-assed.