简体   繁体   English

如何使用C#代码从ftp服务器文件夹中自动拾取文件并将文件名内容保存在SQL数据库表中

[英]How to auto pick up files from ftp server folder and save the filename content in SQL database table using C# code

I'm new in my development role, I have to automatically pick up multiple files in specific format once per week from the FTP folder. 我是开发人员的新手,我必须每周一次从FTP文件夹自动提取特定格式的多个文件。

The file names are in this format: 文件名采用以下格式:

PODLM_10011548501_PTY002323_8569865954.tiff
PODLM_10011548502_PTY002324_8569865955.tiff

After picking them up, I need to save the filename info into an existing SQL table called order as follows: 拾取它们后,我需要将文件名信息保存到一个名为order的现有SQL表中,如下所示:

Order table: Order表:

id   CodeNumber     PPNumber    ClientID     
1    10011548501    PTY002323   8569865954
2    10011548502    PTY002324   8569865955

Any advice or solution will be appreciated 任何建议或解决方案将不胜感激

Thanks 谢谢

I suggest you to split this question into 4 small questions: 我建议您将这个问题分为四个小问题:

Read files from ftp? 从ftp读取文件?

Create a weekly task? 创建每周任务?

Split a string and save it in a model? 分割字符串并将其保存在模型中?

Save a model in sql data base? 在sql数据库中保存模型?

Google these questions and you will be in your way to accomplish the mission, Google这些问题,您将一路完成任务,

Good luck. 祝好运。

What we've done in the past is to create small app, can be a console app that reads the folder in question. 我们过去所做的是创建小型应用程序,它可以是读取有问题的文件夹的控制台应用程序。 Makes no difference if it is an ftp folder or what the file type is. 如果它是ftp文件夹或文件类型是什么都没有关系。 You determine that. 您确定。 In that same app you can connect to you DB and then save any info you need. 在同一应用中,您可以连接到数据库,然后保存所需的任何信息。

Then using MS scheduler you can create a schedule to schedule your app to run once a week, or at any interval you choose 然后,使用MS Scheduler,您可以创建一个时间表来安排您的应用每周运行一次,也可以选择您选择的任何间隔运行

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Chrome可以使用C#自动从数据库中获取用户名和密码 - Can Chrome auto pick up a username and password from a database using C# 如何使用 C# 在 SQL 服务器数据库中保存 DataGridViewComboBoxColumn - How save DataGridViewComboBoxColumn in SQL Server database using C# 如何编写正确的语法从C#代码重命名SQL Server数据库表? - How to write correct syntax to rename SQL Server database table from C# code? 如何在C#中的ftp服务器中保存图像? - how to save image in ftp server in c#? 如何使用C#代码检查SQL Server中是否有表? - How to check if there is a table in sql server or not using c# code? 如何使用C#将多个文件从FTP服务器传输到本地目录? - How to transfer multiple files from FTP server to local directory using C#? 从 SQL 服务器下载文件并使用 c# 保存到固定文件夹 - Download file from SQL Server and save to fix folder using c# 使用C#中的Fluent FTP从FTP服务器获取最后添加/复制的文件 - Get last added/copied files from FTP Server using Fluent FTP in c# 将文件从 C# 中的 FTP 服务器下载到修改日期大于指定的本地文件夹 - Download files from FTP server in C# to local folder with modification date greater than specified 如何使用C#从FTP下载大量文件? - How to Download Numerous Files from FTP using C#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM