Click here to Skip to main content
15,444,353 members
Home / Discussions / Web Development
   

Web Development

 
QuestionImport Excel sheet into Gridview and SQL Pin
Michael Hinkle18-May-21 16:41
MemberMichael Hinkle18-May-21 16:41 
AnswerRe: Import Excel sheet into Gridview and SQL Pin
Richard MacCutchan18-May-21 21:15
mveRichard MacCutchan18-May-21 21:15 
GeneralRe: Import Excel sheet into Gridview and SQL Pin
Richard Deeming18-May-21 21:39
mveRichard Deeming18-May-21 21:39 
GeneralRe: Import Excel sheet into Gridview and SQL Pin
Richard MacCutchan18-May-21 22:01
mveRichard MacCutchan18-May-21 22:01 
GeneralRe: Import Excel sheet into Gridview and SQL Pin
Michael Hinkle19-May-21 17:27
MemberMichael Hinkle19-May-21 17:27 
AnswerRe: Import Excel sheet into Gridview and SQL Pin
Richard Deeming18-May-21 21:42
mveRichard Deeming18-May-21 21:42 
AnswerRe: Import Excel sheet into Gridview and SQL Pin
Mycroft Holmes20-May-21 12:55
professionalMycroft Holmes20-May-21 12:55 
AnswerRe: Import Excel sheet into Gridview and SQL Pin
David Mujica21-May-21 5:26
MemberDavid Mujica21-May-21 5:26 
Here is something that I use in my web app ...

1) Define a connection string pointing to the Excel file
VB
String.Format("Provider=Microsoft.ACE.OLEDB.12.0; Data Source = {0}; Extended Properties='Excel 12.0; HDR=Yes; IMEX=1;'", sFilename)


2) You can access some schema information from the Excel doc like this ...
VB
DTschema = dbConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing)


3) Then get to the actual data in the spreadsheet like this ...
VB
Using dbCmd As New OleDbCommand("SELECT * FROM [" & sSheet & "]", dbConn)
  Using dbAdapter As New OleDbDataAdapter(dbCmd)
    dbAdapter.Fill(DT)
  End Using


It may not be pretty, but you get the data from the spreadsheet into a datatable which can then be bound to a Gridview.

See if it works for you.
Thumbs Up | :thumbsup:
AnswerRe: Import Excel sheet into Gridview and SQL Pin
SeeSharp214-Jul-21 10:41
MemberSeeSharp214-Jul-21 10:41 
QuestionBlazor + MVC Pin
Super Lloyd11-May-21 4:37
MemberSuper Lloyd11-May-21 4:37 
AnswerRe: Blazor + MVC Pin
Super Lloyd11-May-21 4:58
MemberSuper Lloyd11-May-21 4:58 
QuestionIntegrate 3rd party Authenticator app Pin
Super Lloyd10-May-21 13:47
MemberSuper Lloyd10-May-21 13:47 
AnswerRe: Integrate 3rd party Authenticator app Pin
Richard Deeming18-May-21 4:06
mveRichard Deeming18-May-21 4:06 
GeneralRe: Integrate 3rd party Authenticator app Pin
Super Lloyd18-May-21 16:48
MemberSuper Lloyd18-May-21 16:48 
QuestionCSS not showing on my website! HELP! Pin
Gee_Suss 9-May-21 11:27
MemberGee_Suss 9-May-21 11:27 
AnswerRe: CSS not showing on my website! HELP! Pin
SeanChupas11-May-21 3:04
MemberSeanChupas11-May-21 3:04 
QuestionFiltering an array of objects based on (another object/array of objects) Pin
Pavithran R8-May-21 9:07
MemberPavithran R8-May-21 9:07 
AnswerRe: Filtering an array of objects based on (another object/array of objects) Pin
jsc429-May-21 22:33
professionaljsc429-May-21 22:33 
QuestionPHP7, uasort method, return new instance Pin
jkirkerx23-Apr-21 8:12
professionaljkirkerx23-Apr-21 8:12 
AnswerRe: PHP7, uasort method, return new instance [Maybe Solved] Pin
jkirkerx24-Apr-21 9:53
professionaljkirkerx24-Apr-21 9:53 
Questionsearch word in code phpstorm Pin
sookitak18-Apr-21 4:06
Membersookitak18-Apr-21 4:06 
AnswerRe: search word in code phpstorm Pin
SeanChupas23-Apr-21 9:16
MemberSeanChupas23-Apr-21 9:16 
QuestionMaster Detail CRUD using blazor Pin
sanket16413-Apr-21 20:52
Membersanket16413-Apr-21 20:52 
SuggestionRe: Master Detail CRUD using blazor Pin
Shaun C Curtis14-Apr-21 6:37
mvaShaun C Curtis14-Apr-21 6:37 
GeneralRe: Master Detail CRUD using blazor Pin
sanket16414-Apr-21 8:40
Membersanket16414-Apr-21 8:40 

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.