C# Tutorial - Import data from Excel to SQL Server | FoxLearn
ฝัง
- เผยแพร่เมื่อ 3 พ.ย. 2024
- How to Import data from Excel to SQL Server using Z.Dapper, ExcelDataReader in C# .NET Windows Forms Application.
Website: foxlearn.com
import data from excel to sql server using c# windows application
Please can you share de code, i facing trouble on ready object, the method "AsDataSet". I want see the import part. I already was i your web page i saw the code but the import part is cutted.
an error occured while retrieving the InformationSchemaTable information. See the inner exception for details.
i get this error when i click the import button at the end. i checked every code and any detail may help online but stucked. i need some help.
What i say about you...Previous Comments will say all and Your the Best FoxLearn.
thanks your explanation is very helpful
Hi, ¿How I can do this, but having more excel sheets in the excel file, and each sheet have to import to a table in SQL?, thx
whats the difference between Dapper ORM and Z.Dapper please
Great Tutorial and quality as always, Fox Learn, I am having one issue, the column name in EXCEL contains "Spaces" and Some Special Chars too, e.g. Customer ID, Sr No. etc; so how to add those in class file e.g. shown in 11:55 ,
public string "ColumnNameWithSpace" {get; set;}
Please help me in this case!
Would Datatable work instead of class?
how about the updating the table by importing the new and updated csv file ?
do you have any tutorial on that ? thanks for the reponse
Hello and thank you for this tutorial, it has been very helpful. I was wondering if you have an example on the same example, but with some validation to avoid duplicate entries. Thank you very much for your work.
Hi same i want to add validation for avoid duplicate records
Hi, I have tried this it is taking more time to execute dB.BulkInsert line , not stopping . Can you help me
Hello, I already have the data in the database.how to add data from excel in this case?
Thank you, Thank you, Thank you, Can not thank you enough.
You're welcome. Thank you so much !
on8:28 where you add your
CboSheet.Items.Add(table.TableName);
it keeps telling me the name table doesnt exist in the current context
and i have typed word for word can you please help me
System.NotSupportedException: 'No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.' i am getting erroe from this code will u help me
adding this to main method might solve the problem:
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance)
Excellent ! Thank you very much for this video.
What shoudl I put to the tableCollection If I want all sheets to be uploaded?
Hello Sir, I am using visual studio 2015 and sql server 2019. I tried to connect it to visual studio 2015 and it worked. However, when I try to open new query in visual studio from sql server 2019 connection, "an incompatible sql version was detected" window pops out. Is it true that both of them are incompatible? Thanks. It also appears when i try to right click the table inside it when i try to show table data.
can you make a delete button that delete the imported file in the databse
How to map the column name with space. For example if the column name is First name in SQL than how can we map in c# code
I would like to know this as well
Also, what if the values in the SQL database aren't all just varchars - I have a situation where float values are imported as NULL
Foxlearn can u make a tutorial were you make a terminal like cmd? I need to know i wanna make something like that. You can use console C# or just desktop app C#
i forgot to subscribe :(((
OK. Thank you for your suggestion !
Thank uuuuu soooooo Muchhh !!!!!! u save my life !! :))))
Awesome Video Thank you so much
What about if i have a foreign key because i create a two different data gridview eith different items but have a foreign key
Insert parent first, then child. and each parent you should add key
how to mapping sheet column and class variable means any one choose and map both column before show on datagrid just like sql import wizard
Thank youuuuuuuuuuuu very very much!!!!!!!!!!!!!!!!!!!!!!!!!!!
It Worksss
Its faster to just save the Excel file as CSV and in SQL Server: rightclick database > Tasks > Import Flat File > done!
Hi ! Thanks for you Tutorrial. This is really awesome...
How to fix Dapper trial expired
I use visual studio 2010 so i can not add z. Dapper plus like this video. So how can i do this without z. Dapper plus, i want to import excel file to sql server. Fox Learn help me please!
You can download offline library from nuget
thank you for this! very clear tutorial :)
Glad it was helpful!
Have a problem with binding source to datagridview in 13.18 seconds you clicked on datagrid view datasource selecting dropdown and selecting “other data sources”. But in my case it wouldn't appear.what should i do to add it?
Did you find out a solution? I have the same issue ;-)
@@muskape How about you? Ever found a solution?
Did you find out a solution? I have the same issue, I use VS 2019
HI! Thanks for your tutorial, it's very nice! Could you help me, since I'm from Access and I'm a beginner in C #? I made this project, but instead of using the mdf database I'm using dataset (in my case called "Database"). My excel file has 2 columns (IDComuni and Comune), and in the Dataset I created the "Comuni" table with 2 fields (IDComuni "int32" and Comune). Now the problem is to load this data from the Datagridviewer to the table.
// --- DapperPlusManager.Entity () .Table ("Comuni");
using (IDbConnection db = new SqlConnection ("? ....?"))
{
db.BulkInsert (list); - //
How can I modify this syntax so that it can load everything in the "Comuni" table? Thank you!
when I try to run the program at 9:10 I get an Exception Thrown,
System.NullReferenceException: 'Object reference not set to an instance of an object.' System.Windows.Forms.ComboBox.SelectedItem.Get returned null.
I've copied everything in this video word for word, is there something I've missed?
Have you add sheet name to combobox?
@@foxlearn the program crashes before I am able to use the form. The exception points to this line of the code.
private void CboSheet_SelectedIndexChanged(object sender, EventArgs e)
{
DataTable dt = tableCollection[cboSheet.SelectedItem.ToString()];
dataGridView1.DataSource = dt;
how to add validation if all the imported data already exists in the database ?
I think you can write stored procedure, check data already exists before insert
Can anyone please where is this variable declared customerBindingSource customerBindingSource.DataSource = list;
Hi. My DataGridView can not pick up Class Customer after I create it on visual Studio
Yes me to , help me
DapperPlusManager.Entity().Table("Account"); what is this line doing ?
I help you mapping account to table account
For example: entity class: Accounts you can map to account table or user table....
Awesome!
Thank you !
Thank You !!
Thank you !
how do i add csv file ?
"An error occurred while retrieving the InformationShemaTable information. See the inner exception for details." This is the I have when I click import to database please some help me out
Same problem dude, any resolve ?
Con you make a tutorial that excute the excel file that contain SQL command to SQL Server
Can you describe more details. thank you !
can I also apply for xamarin forms?
Thank you for your suggestion !
AsDataSet Not definition DataSet result = reader.AsDataSet(new ExcelReaderConfiguration()
You should install ExcelDataReader.DataSet. Thank you !
any solution for Import data from Excel to phpmyadmin
Let me try to research. Thank you !
thank you, can't thank u enough
Pro trick: watch movies on Flixzone. Been using them for watching lots of of movies recently.
@Sergio Dexter Yup, have been watching on Flixzone} for months myself :)
@Sergio Dexter Yup, been watching on Flixzone} for years myself :)
@Sergio Dexter yea, have been using Flixzone} for months myself =)
@Sergio Dexter yup, I have been watching on flixzone} for years myself :)
Can you make a tutorial how to insert PDF file to SQL as file
OK. Thank you for your suggestion. I'll make soon.
please , i want this project
Awesome!
I need your help.
I want to import data this data using ADO.NET Entity Data Model.
I have DB Connection, Example:
using(dbDemoEntities db = new dbDemoEntities())
{
-----------
}
How I can replace this method to above.
public void Insert(List list)
{
DapperPlusManager.Entity().Table("Student");
using (IDbConnection db = new SqlConnection("Data Source=DESKTOP-7F885GH\\SQLEXPRESS;Initial Catalog=Demo;Integrated Security=True"))
{
db.BulkInsert(list);
}
}
Thanks in Advance FoxLearn.
it ignores russian characrters. how to handle that please help m,e
You should define your column is nvarchar, then try to import
How can i block multiple data ?
Can you describe more details. thank you !
@@foxlearn example i have customer id 2614 saved on my database.when i add gridview excel customer id 2614 messagebox.show this customer id already exist
is c# dying?
What do you mean?
Can u explain more your question..?
Alguien que haga el mismo video y lo traduzca?
What do you mean?
sir why Filemode and File access are error in mine??
I got the same problem. Did you get any solution ?
beware Dapper Plus is not free !!!! they will expired with in one month after use this library
....
Thank you !
how to do this with phpmyadmin database?
Sorry man. I'm not using phpmyadmin
@@foxlearn i already use phpmyadmin and it works