I am trying to create a method, which can upload data from xls sheet into a sql server database table. This is what my database table looks like:
[id]
,[tag]
,[decimalP]
,[type]
,[UploadDate]
,[name]
FROM [dummy].[dbo].[database_data]
However, I have data in my excel sheet starting from tag filed name. When I try to upload the excel sheet of data into the table above, it throws error, saying i cannot have 'id' null. Is there a way of uploading the data into database table from excel
sheet(without the ID), and sql increment the id automatically whenever new data is added.
This what I have so far:
protected void Upload(object sender, EventArgs e)
{
//Upload and save the file
string excelPath = Server.MapPath("~/Files/") + Path.GetFileName(FileUpload1.PostedFile.FileName);
FileUpload1.SaveA ...
Go to the complete details ...