将值传递到文本框中 [英] pass through value in to text box

查看:122
本文介绍了将值传递到文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将excel单元格中的值传递到文本框中的变量中.我该怎么办?

对于示例(简单),我在文本框中具有以下代码,日期显示在excel中不同工作表的单元格"A1"中.我正在寻找可以在单元格"A1"中输入新日期的日期(例如2011年4月30日),而无需更改代码.

I am trying to pass through a value in a cell in excel into a variable in a textbox. How can I do that?

For Example (simple) I have the following code in a textbox, the date appears in cell "A1" on different worksheet in excel. I am look for something that will pass through the new date I enter in cell "A1" (e.g. 4/30/2011) without me having to change the code.

SELECT
	ReportingRegion,
	CRLLT,
	CRLLD,	

FROM
	RetailReporting

WHERE
	date = 3/31/2011 


谢谢,

推荐答案

我认为您正在询问如何从Excel文档中检索单元格值,以便可以在您的应用程序中使用它们,例如用于填充表单控件.

1.使用组件读取Excel文件.此站点上有许多针对现代OpenXml和旧式BIFF格式的示例.

2. 使用Interop来控制Excel实例 [ ^ ]检索您感兴趣的值.

3. 使用ADO.NET数据提供程序. [这是使用OLE(COM +的子集) [
I think you are asking how to retrieve cell values from an Excel document so that they can be used in your application, such as for populating form controls.

1. Use a component to read excel files. There are many examples of this on this site for both modern OpenXml and the legacy BIFF format.

2. Use Interop to control an instance of Excel[^] in order to retrieve the values you''re interested in.

3. Use an ADO.NET data provider.[^] This will allow you to query the spreadsheet with SQL-like syntax such as in your example.

I could also interpret your question as to how you can link an Excel document to your application so that changes to the source document are automatically updated in your application.

4. This is accomplished using OLE, a subset of COM+,[^]


这篇关于将值传递到文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆