Click here to Skip to main content
15,913,758 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: focus Pin
Coding C#14-Aug-09 2:23
Coding C#14-Aug-09 2:23 
Questionvideo gallery problem... Pin
RajpootRohan13-Aug-09 22:46
professionalRajpootRohan13-Aug-09 22:46 
AnswerRe: video gallery problem... Pin
padmanabhan N13-Aug-09 23:01
padmanabhan N13-Aug-09 23:01 
GeneralRe: video gallery problem... Pin
RajpootRohan13-Aug-09 23:55
professionalRajpootRohan13-Aug-09 23:55 
GeneralRe: video gallery problem... Pin
padmanabhan N13-Aug-09 23:57
padmanabhan N13-Aug-09 23:57 
GeneralRe: video gallery problem... Pin
Coding C#14-Aug-09 2:26
Coding C#14-Aug-09 2:26 
Questioninput string was not in a correct format Pin
haleemasher13-Aug-09 22:33
haleemasher13-Aug-09 22:33 
AnswerRe: input string was not in a correct format [modified] Pin
Vimalsoft(Pty) Ltd13-Aug-09 22:55
professionalVimalsoft(Pty) Ltd13-Aug-09 22:55 
Good day haleemasher

Change your code to

protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            ErrorMessage.Text = "";
            cnx.Open();
            SqlCommand insertCmd = new SqlCommand("insert into CouponTransaction(CouponTypeID)values(@id)", cnx);
                        
            insertCmd.Parameters.Add("@Id", SqlDbType.int);
            insertCmd.Parameters["@Id"].Value = Convert.ToInt32(ToddlCType.SelectedValue);
                   
            insertCmd.ExecuteNonQuery();
            ErrorMessage.Text = "Records inserted successfully";
            cnx.Close();
        }
        catch (Exception ex)
        {
            ErrorMessage.Text = ex.Message;
        }


You must put a break point and check what results you get from the selected value. it might have returned an empty string that is why you got that error. You must stop assuming the input from the user is correct.

Try it and tell me what it does

Vuyiswa Maseko,

Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/

modified on Friday, August 14, 2009 5:37 AM

GeneralRe: input string was not in a correct format Pin
haleemasher13-Aug-09 23:14
haleemasher13-Aug-09 23:14 
GeneralRe: input string was not in a correct format Pin
Vimalsoft(Pty) Ltd13-Aug-09 23:39
professionalVimalsoft(Pty) Ltd13-Aug-09 23:39 
GeneralRe: input string was not in a correct format Pin
haleemasher13-Aug-09 23:47
haleemasher13-Aug-09 23:47 
GeneralRe: input string was not in a correct format Pin
Vimalsoft(Pty) Ltd14-Aug-09 0:29
professionalVimalsoft(Pty) Ltd14-Aug-09 0:29 
AnswerRe: input string was not in a correct format Pin
padmanabhan N13-Aug-09 22:56
padmanabhan N13-Aug-09 22:56 
GeneralRe: input string was not in a correct format Pin
haleemasher13-Aug-09 23:05
haleemasher13-Aug-09 23:05 
GeneralRe: input string was not in a correct format Pin
padmanabhan N13-Aug-09 23:14
padmanabhan N13-Aug-09 23:14 
GeneralRe: input string was not in a correct format Pin
haleemasher13-Aug-09 23:19
haleemasher13-Aug-09 23:19 
GeneralRe: input string was not in a correct format Pin
padmanabhan N13-Aug-09 23:29
padmanabhan N13-Aug-09 23:29 
GeneralRe: input string was not in a correct format Pin
haleemasher13-Aug-09 23:59
haleemasher13-Aug-09 23:59 
GeneralRe: input string was not in a correct format Pin
padmanabhan N14-Aug-09 0:03
padmanabhan N14-Aug-09 0:03 
GeneralRe: input string was not in a correct format Pin
haleemasher14-Aug-09 0:14
haleemasher14-Aug-09 0:14 
GeneralRe: input string was not in a correct format Pin
DoctorMick14-Aug-09 0:32
DoctorMick14-Aug-09 0:32 
GeneralRe: input string was not in a correct format Pin
Coding C#14-Aug-09 2:39
Coding C#14-Aug-09 2:39 
Questionbind a girdview with a form view Pin
haleemasher13-Aug-09 22:26
haleemasher13-Aug-09 22:26 
AnswerRe: bind a girdview with a form view Pin
Vimalsoft(Pty) Ltd13-Aug-09 23:01
professionalVimalsoft(Pty) Ltd13-Aug-09 23:01 
AnswerRe: bind a girdview with a form view Pin
padmanabhan N13-Aug-09 23:31
padmanabhan N13-Aug-09 23:31 

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.