如果在C#之前找到它,如何防止将项目添加到excel 2007 [英] How to prevent adding item to excel 2007 if it found before C#
问题描述
我在c#2015窗口工作表格
我有excel文件2007名册1和里面的表格名单1
< br $>
第1页有两列
用户ID
用户名
我需要从windows窗体中插入新记录c#
来检查显示之前是否找到用户名的值客户留言告诉他用户名存在之前
用户ID用户名
1 michel
2 marten
如果用户输入marten的文本框值,则单击按钮插入
给我一个消息,这个名字存在之前
使用c#windows窗口
如果可能的话,如何通过c#做到这一点
我的尝试:
如果在c#
所以你应该在列中包含用户ID的Vlookup(我假设你使用SQL来检查),然后返回下一列信息,如果它返回信息,那么UserID已经在使用中。无需显示信息,只需通知Windows窗体再试一次。
当您使用UserID时,我假设您正在尝试创建一个访问验证的用户列表。如果您正在尝试验证用户,则需要重新考虑列及其使用方式。
向我们提供有关您为什么这样做的更多信息,因为它也许可以帮助你找到更好的方法。
I work in c# 2015 windows form
I have excel file 2007 name book 1 and sheet inside it name sheet 1
sheet 1 have two column
UserID
UserName
I need when insert new record from windows form c#
to check if the value of User Name found before show to client message tell him that Username exist before
UserID UserName
1 michel
2 marten
IF user enter in textbox value of marten then click button insert
give me message that this name exist before
using c# windows form
How to do that by c# if possible
What I have tried:
How to prevent adding item to excel 2007 if it found before c#
So you should do a Vlookup on the column with the userID in it (I assume you're using SQL to check), then return the next column information, if it returns information, then that UserID is already in use. No need to show the information, just notify the windows form to try again.
As you are using a UserID, I'm assuming that you are trying to create a list of users for access validation. If you are trying to validate users, you need to rethink the columns and the way it's used.
Give us some more information on why you are doing this, because it may be possible to help you find a better method.
这篇关于如果在C#之前找到它,如何防止将项目添加到excel 2007的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!