Error..
-
please read this and tell me my mistake. cn.Open(); cmd.CommandText = "Select ATT_DATE,DEP_ID,to_char(timein,'HH:MI'),to_char(timeout,'HH:MI'),EMP_NAME from attandance where emp_id = '" + id.Text + "' and shift = '" + shift.SelectedItem + "'"; odr = cmd.ExecuteReader(); while (odr.Read()) { ename.Text = odr["emp_name"].ToString(); dept.Text = odr["dep_id"].ToString(); timein.Text = odr["timein"].ToString(); timeout.Text = odr["timeout"].ToString(); Dte.Text = odr["att_date"].ToString(); }
-
please read this and tell me my mistake. cn.Open(); cmd.CommandText = "Select ATT_DATE,DEP_ID,to_char(timein,'HH:MI'),to_char(timeout,'HH:MI'),EMP_NAME from attandance where emp_id = '" + id.Text + "' and shift = '" + shift.SelectedItem + "'"; odr = cmd.ExecuteReader(); while (odr.Read()) { ename.Text = odr["emp_name"].ToString(); dept.Text = odr["dep_id"].ToString(); timein.Text = odr["timein"].ToString(); timeout.Text = odr["timeout"].ToString(); Dte.Text = odr["att_date"].ToString(); }
That depends. what is going wrong ? Is there an error message ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
please read this and tell me my mistake. cn.Open(); cmd.CommandText = "Select ATT_DATE,DEP_ID,to_char(timein,'HH:MI'),to_char(timeout,'HH:MI'),EMP_NAME from attandance where emp_id = '" + id.Text + "' and shift = '" + shift.SelectedItem + "'"; odr = cmd.ExecuteReader(); while (odr.Read()) { ename.Text = odr["emp_name"].ToString(); dept.Text = odr["dep_id"].ToString(); timein.Text = odr["timein"].ToString(); timeout.Text = odr["timeout"].ToString(); Dte.Text = odr["att_date"].ToString(); }
mjawadkhatri wrote:
tell me my mistake.
Not telling us what the error message says and which line it occurs on? :)
Regards David R --------------------------------------------------------------- "Every program eventually becomes rococo, and then rubble." - Alan Perlis
-
That depends. what is going wrong ? Is there an error message ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Error Message is INDEX OUT OF RANGE EXCEPTION WAS UNHANDLED
-
mjawadkhatri wrote:
tell me my mistake.
Not telling us what the error message says and which line it occurs on? :)
Regards David R --------------------------------------------------------------- "Every program eventually becomes rococo, and then rubble." - Alan Perlis
Error Message is INDEX OUT OF RANGE EXCEPTION WAS UNHANDLED line of Error is timein.Text = odr["timein"].ToString();
-
Error Message is INDEX OUT OF RANGE EXCEPTION WAS UNHANDLED
that because you dont specify return field name for time in try change your query in "to_char('timein',...) as timein" hope it helps
dhaim ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro" in the front line gave a lead, in the middle line build goodwill, in the behind give power support
-
that because you dont specify return field name for time in try change your query in "to_char('timein',...) as timein" hope it helps
dhaim ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro" in the front line gave a lead, in the middle line build goodwill, in the behind give power support
I change my query like; "to_char('timein','HH:MI')as timein" now Error Message Change ERROR [22018] [Microsoft][ODBC driver for Oracle][Oracle]ORA-01722: invalid number
-
Error Message is INDEX OUT OF RANGE EXCEPTION WAS UNHANDLED line of Error is timein.Text = odr["timein"].ToString();
So, there is no column called 'timein'. I suspect you need to read a few basic books before doing any more work, the error message is pretty self documenting, and googling it would have got you a ton of info
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
I change my query like; "to_char('timein','HH:MI')as timein" now Error Message Change ERROR [22018] [Microsoft][ODBC driver for Oracle][Oracle]ORA-01722: invalid number
then try to follow this link ORA-01722: invalid number[^] hope it helps
dhaim ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro" in the front line gave a lead, in the middle line build goodwill, in the behind give power support
-
please read this and tell me my mistake. cn.Open(); cmd.CommandText = "Select ATT_DATE,DEP_ID,to_char(timein,'HH:MI'),to_char(timeout,'HH:MI'),EMP_NAME from attandance where emp_id = '" + id.Text + "' and shift = '" + shift.SelectedItem + "'"; odr = cmd.ExecuteReader(); while (odr.Read()) { ename.Text = odr["emp_name"].ToString(); dept.Text = odr["dep_id"].ToString(); timein.Text = odr["timein"].ToString(); timeout.Text = odr["timeout"].ToString(); Dte.Text = odr["att_date"].ToString(); }
-
please read this and tell me my mistake. cn.Open(); cmd.CommandText = "Select ATT_DATE,DEP_ID,to_char(timein,'HH:MI'),to_char(timeout,'HH:MI'),EMP_NAME from attandance where emp_id = '" + id.Text + "' and shift = '" + shift.SelectedItem + "'"; odr = cmd.ExecuteReader(); while (odr.Read()) { ename.Text = odr["emp_name"].ToString(); dept.Text = odr["dep_id"].ToString(); timein.Text = odr["timein"].ToString(); timeout.Text = odr["timeout"].ToString(); Dte.Text = odr["att_date"].ToString(); }
-
In addition to your missing columns, your code is vulnerable to SQL injection. You might want to look into stored procedures
Between the idea And the reality Between the motion And the act Falls the Shadow
"You might want to look into stored procedures parameterized statements." (Regardless of whether or not the statement executes a stored procedure.)
-
"You might want to look into stored procedures parameterized statements." (Regardless of whether or not the statement executes a stored procedure.)