将数据从记事本导入数据库表

编程入门 行业动态 更新时间:2024-10-26 10:26:41
本文介绍了将数据从记事本导入数据库表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

任何人都可以帮我解决如何使用asp从Excel工作表和记事本添加数据(电子邮件地址)到mssql中的表格。每个用户可以拥有多个电子邮件地址。我检查了某些代码但不满意。给我一个解释,如果记事本是excel和电子邮件地址,代码将如何识别每个列标题。任何代码。

Can anyone help me on how to add data(email address) from excel sheet and notepad to a table in mssql using asp. Each user can have more than one email address. I checked certain codes but not satisfactory. give me an explanation on how the code will identify each column header in case of excel and email addresses in case of notepad. Any codes.

推荐答案

使用正则表达式解析文本。 Use regex to parse the text. using System.Text.RegularExpressions; ... string input="someone@somedomain.au is an email address... and someone@anotherdomain is yet another one."; string pattern="\\b[\\w\\.-]+@[\\w\\.-]+\\.\\w{2,4}\\b"; var matches =Regex.Matches( input,pattern); string[] addresses = matches.OfType<match>().Select(m => m.Value).ToArray();

您的输入字符串将是您的文本文件的内容,或者在excel你可以把每个单元格读成一个StringBuilder变量。 ATG

your input string would be the contents of your text file or in the case of excel you could read each cell into a StringBuilder variable. ATG

更多推荐

将数据从记事本导入数据库表

本文发布于:2023-10-22 23:15:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519015.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:记事本   数据库   数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!