HOW TO IMPORT EXCEL FILE TO DATAGRIDVIEW AND SAVE TO DATABASE USING C#

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
good day everyone welcome to cape cod okay guys allow user to add rows defaults nothing raw header visible and then atom selection mode i full row select yeah and then make like a tile now header so let me turn ahead and not then you row number and then employee id last name first name middle name and then address at your contact number okay so are you scanning auto size mode so coming down nothing all cells all cells in last name all cells okay all cells patient middle name and then your address give me nothing fill at your contact i all cells okay so marina okay and then again import file or excel file so give me import import excel name ptn import and then i'm just under nothing government i you open file dialog okay a tiny open file dialog okay open file dialog box name open fd double click nothing to import excel okay and then solution explorer okay then it was a reference nut then right click nothing and then manage nugget packages yeah dandy to sub browse tab so search lang nathan excel okay and then install nothing don't microsoft office interrupt excel and install nathan okay so yeah install now then close the nut into okay so after nothing installs we're using microsoft dot office that interrupt that exit okay and then detail some button import song nothing can i gain attention microsoft office then that interrupt that uh excel and then that application and tapos young adding and then microsoft that office okay work book yeah range okay and then what i file name and then data then filter okay so excel office and then uh excel format xls at the heart noun xl sx format yeah and then jump right detail now give me nothing open fd dot show dialog okay let's choose an audio adding variable na string file name equals l open file dialogue now file name so parama lang young named excel file okay and then what i did now uh condition okay if sdr file name not equal to null or gonna win attend i x l up and equals new uh microsoft that office that interrupt okay that excel that application yeah and then you're adding excel workbook okay equals to xl app and excel app dot work play workbook workbooks okay work books and then uh that open okay you adding is str file name or string or your file name okay and then foreign worksheet equals xl workbook ups xl workbook that work that is adding excel so i'm named neto i one okay one so young i think inaudible uh range xl range or excel range equals to uh xl work sheet okay then that use range okay and then i'm okay so target in cxlro equals two okay and bracket two okay x l row okay then x l row less than equal to x l range henna that rows that count okay and then jump right xlro plus plus okay so details employees okay that rose that ad and then again i okay and then you x l range and that cells and then you adding xl row one that text and that text okay the melon tile uh excel range that cell xlro one submarine one accidental one two three four five six okay the time one you adding employee id so happy long naughty neeto so let o2 three 4 then 5 at 6 okay so little casey one young adding header one two three four five six volume not then okay and then suicide i xl range or xl workbook that close okay and then x and uh up that quick iran okay written on nothing more granulating application so import excel submarine open dialog okay open file dialog then ato you adding excel file sample data so papa signing time foreign okay you adding uh excel file data ethernet data so i think data grid view so [Music] not internal condition okay condition if yan if xlro okay or xlrange xlrange dot cell okay and then xlrow one dot text not equal to null yeah so import okay sample data yeah so well data okay save okay yeah so namely nothing tongue btn save okay and then [Music] string [Music] [Music] and then uh string cone equals to deuteronomy i think connection string then return and then paste the data okay then black tiles adding code behind it form one so atlanta reference using a system that data that sql client and then variable it's a connection sql connection con okay and then sql command cmd sql data reader dr you know adding uh plus okay connection db so db equals the new connection db then detail [Music] okay new sql connection then db dot get connection you're gonna want nothing metal doonsan that's nothing yeah and then um load record zito method uh publix public void sofa no from database to data grid parameters nothing need to time plug in function con that open okay then con that close yeah okay cmd equals to new sql command in query nothing i select all tbl employees okay and then you connection attend then employees data starting database i am pbl employees and then meronshang isang record okay manager is a record okay dendito is not nothing i dr equals to cmd that execute reader okay and then while dr.read and and then uh the game on an attendee to you dgp that rose that clear no for uh clearing data grid view or at entire now in i equals to zero no parallel number of pros nothing okay so in a i plus plus and and then dgb that rows that add okay and then i dr [Music] uh first name and then uh middle name address okay number a temporary so try not then okay incorrect syntax near tblo id so employees id okay employees okay s employee id okay record okay the helmet is this is about an import okay and click on that open okay then turn that close yeah so cmd equals to new scl command okay insert into tbl employees and then again attenuating employee id okay last name first name then deter your attend connection next you're adding cmd that parameters that add with value okay and um i equals to zero okay then i less than uh dgb dot rows that count han tapos it will purpose not in detail yeah sodito my own dgb that rose i that cells okay 0 that value that 2 3 0 1 2 three four five and six okay so happiness employee id last name first name middle name address and then contact okay last name first name middle name address okay then six and then young cmd dot execute none query okay then the time now message box that show and record successfully okay save and then message along the new message box button that okay at message box icon that in for nation then did nothing in the load then attenual records now after nothing let's see data so try nothing okay so mero nakodito is a record now then import excel so nothing much load load record from excel file upon the data set data grid view and then it's saved so click nothing to button save record successfully save okay so merenting error the duplicate key values is twenty twenty one zero zero zero five lampana sodapath i so import excel file so yeah and then save record successfully save so from excel file lopez john maynard gambilia verte video so that's it thank you [Music] bye
Info
Channel: Just a Minute
Views: 6,318
Rating: undefined out of 5
Keywords: csharp, asp.net, asp, .net, csharp tutorial, learn c#, c#, c# programming, c# tutorial, how to import excel file, how to import excel into datagridview, how to import excel to database
Id: LDq4C_wF0fs
Channel Id: undefined
Length: 35min 44sec (2144 seconds)
Published: Wed May 05 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.