本文介绍了将数据从记事本导入数据库表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以帮我解决如何使用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
更多推荐
将数据从记事本导入数据库表
发布评论