Click here to Skip to main content
16,008,010 members
Home / Discussions / C#
   

C#

 
Question[Message Deleted] Pin
Trustapple16-Oct-07 8:21
Trustapple16-Oct-07 8:21 
AnswerRe: compile time Pin
Dave Kreskowiak16-Oct-07 8:29
mveDave Kreskowiak16-Oct-07 8:29 
GeneralRe: compile time Pin
Anthony Mushrow16-Oct-07 9:46
professionalAnthony Mushrow16-Oct-07 9:46 
AnswerRe: compile time Pin
led mike16-Oct-07 8:36
led mike16-Oct-07 8:36 
GeneralRe: compile time Pin
MasterSharp16-Oct-07 11:08
MasterSharp16-Oct-07 11:08 
QuestionHelp with SQL Parameter Pin
kallileo16-Oct-07 8:08
kallileo16-Oct-07 8:08 
AnswerRe: Help with SQL Parameter Pin
Giorgi Dalakishvili16-Oct-07 8:48
mentorGiorgi Dalakishvili16-Oct-07 8:48 
GeneralRe: Help with SQL Parameter Pin
kallileo16-Oct-07 9:07
kallileo16-Oct-07 9:07 
Yes I found it few minute later...Thanks

But now I get another error.

protected void Button_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Data Source=(local)\\SQLEXPRESS;Initial Catalog=opc;Integrated Security=True");
conn.Open();
SqlCommand selCmd = new SqlCommand("SELECT COUNT(*) FROM data WHERE timestamp>@date1 AND timestamp<@date2", conn);
SqlParameter param1 = new SqlParameter();
SqlParameter param2 = new SqlParameter();
param1.ParameterName = "@date1";
param1.Value = TextBox1.Text;
selCmd.Parameters.Add(param1);

param2.ParameterName = "@date2";
param2.Value = TextBox2.Text;
selCmd.Parameters.Add(param2);


int count = (int)selCmd.ExecuteScalar();
Label1.Text = count.ToString();
conn.Close();

}
I get this Sql Exception:

Arithmetic overflow error converting expression to data type datetime.

In line "int count = (int)selCmd.ExecuteScalar();"

I need to count the rows between these two dates...
GeneralRe: Help with SQL Parameter Pin
Giorgi Dalakishvili16-Oct-07 9:18
mentorGiorgi Dalakishvili16-Oct-07 9:18 
GeneralRe: Help with SQL Parameter Pin
kallileo16-Oct-07 9:32
kallileo16-Oct-07 9:32 
GeneralRe: Help with SQL Parameter Pin
Giorgi Dalakishvili16-Oct-07 10:43
mentorGiorgi Dalakishvili16-Oct-07 10:43 
QuestionMilitary Time Pin
stormcandi16-Oct-07 7:53
stormcandi16-Oct-07 7:53 
AnswerRe: Military Time Pin
led mike16-Oct-07 8:16
led mike16-Oct-07 8:16 
GeneralRe: Military Time Pin
stormcandi16-Oct-07 8:18
stormcandi16-Oct-07 8:18 
GeneralRe: Military Time [modified] Pin
led mike16-Oct-07 8:28
led mike16-Oct-07 8:28 
GeneralRe: Military Time Pin
Martin#16-Oct-07 8:55
Martin#16-Oct-07 8:55 
GeneralRe: Military Time Pin
led mike16-Oct-07 9:15
led mike16-Oct-07 9:15 
AnswerRe: Military Time Pin
Skippums16-Oct-07 10:07
Skippums16-Oct-07 10:07 
GeneralRe: Military Time Pin
stormcandi16-Oct-07 11:12
stormcandi16-Oct-07 11:12 
QuestionQuestion about Windows Control Libraries and Properties Pin
godspeed12316-Oct-07 7:43
godspeed12316-Oct-07 7:43 
AnswerRe: Question about Windows Control Libraries and Properties Pin
led mike16-Oct-07 8:24
led mike16-Oct-07 8:24 
GeneralRe: Question about Windows Control Libraries and Properties Pin
godspeed12316-Oct-07 9:04
godspeed12316-Oct-07 9:04 
GeneralRe: Question about Windows Control Libraries and Properties Pin
led mike16-Oct-07 9:17
led mike16-Oct-07 9:17 
GeneralRe: Question about Windows Control Libraries and Properties Pin
godspeed12316-Oct-07 12:01
godspeed12316-Oct-07 12:01 
GeneralRe: Question about Windows Control Libraries and Properties Pin
visualhint17-Oct-07 14:04
visualhint17-Oct-07 14:04 

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.