Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void btnUpload_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
    {
        DataSet ds = new DataSet();


        int LastId;
        ds=DB.ExecuteQuery("SelectPreviousId");
        LastId = Convert.ToInt32(ds.Tables[0].Columns[0].ToString());

        //string filename = System.IO.Path.GetFileName(btnUpload.FileName);
        btnUpload.SaveAs(Server.MapPath(this.UploadFolderPath) + LastId);

    }



This is code for async fileupload
i reterive last inserted id+1 values using sp and save my image as id in solution explorer

but it is showing the error
"Input string was not in a correct format."

LastId = Convert.ToInt32(ds.Tables[0].Columns[0].ToString()); error line
Posted

Try this one
Certainly it seams that you don't have return type int so this error occurs

C#
LastId = Convert.ToInt32(ds.Tables[0].Columns[0].ToString()==""?"0":ds.Tables[0].Columns[0].ToString());


This may help you

or

Inspect it properly and coonfirm that there is not string value return type


regards.....:)
 
Share this answer
 
Comments
Mohammed Shamsheer 2-Oct-13 2:37am    
i try this but this also not working
Dholakiya Ankit 2-Oct-13 2:47am    
Still same error occurs? and what you getting value when you are getting error show me full details
Mohammed Shamsheer 2-Oct-13 3:08am    
its solved ...just i changed my code to ds.tables[0][0].tostring();
thanks for ur answer...
Dholakiya Ankit 2-Oct-13 3:09am    
Okay
You are missing the row attributes in your table.
use soething like this table[][]

-SG
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900