从2012 Express Userform将数据发送到Sql表 [英] Send Data to Sql Table from 2012 Express Userform

查看:63
本文介绍了从2012 Express Userform将数据发送到Sql表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在打扰从Visual Studio Userform向sql数据表发送数据。

I'm having a hiccup sending data from the Visual Studio Userform to the sql data table.

该表配置如下:

创建表[dbo]。[管理员]

CREATE TABLE [dbo].[Admin]

([ID]  BIGINT  IDENTITY(1,1)NOT NULL,

([ID]  BIGINT  IDENTITY (1,1) NOT NULL,

[AdminFN] VARCHAR(50)NOT NULL,

[AdminFN] VARCHAR(50) NOT NULL,

[AdminLN] VARCHAR(50)NOT NULL,

[AdminLN] VARCHAR(50) NOT NULL,

[AdminPword] VARCHAR(50 )NOT NULL,

[AdminPword] VARCHAR(50) NOT NULL,

CONSTRAINT [PK_Admin] PRIMARY KEY CLUSTERED([ID] ASC));

CONSTRAINT[PK_Admin] PRIMARY KEY CLUSTERED ([ID] ASC) );

我尝试过使用VBA用于将数据从Visual Studio 2012 Userform发送到表的代码。  我在填充[ID]列时遇到错误。

I've attempted use of the VBA Code to send the data from the Visual Studio 2012 Userform to the Table.  I experience errors in populating the [ID] Column.

错误表明语法必须包含引用[ID]列,但[ID]列配置为自动编号,并设置为主键。

The errors indicate that the Syntax must include a reference to the [ID] column, but [ID] Column is configured to auto number and is setup as the Primary Key.

我尝试使用的代码是:

======================================

======================================

AdminTableAdapter.Insert(AdminFN:= AdminSetupFormFNBox.Text,AdminLN:= AdminSetup FormLNBox.Text,AdminPword:= AdminSetupFormPwordBox.Text,ID:=""  这就是我正在寻找允许表格自动编号的答案。"" )

AdminTableAdapter.Insert(AdminFN:=AdminSetupFormFNBox.Text, AdminLN:=AdminSetupFormLNBox.Text, AdminPword:=AdminSetupFormPwordBox.Text, ID:= ""   this is the answer I'm looking for to allow the table to autonumber."" )

======================================

======================================

如果我删除列[ID]的IDENTITY(1,1)命令并插入固定值,则数据传输完成。 

If I remove the IDENTITY (1,1) command for column [ID] and insert a fixed value, the data transfer is complete. 

我确定答案很简单....请你帮忙。

I'm certain the answer is simple.... would you please assist.

谢谢你。

推荐答案

对不起,这个论坛是仅适用于Microsoft Small Basic语言问题。请在MSDN或TechNet上的SQL论坛上询问。

Sorry, this forum is for Microsoft Small Basic language questions only. Please ask on a SQL forum here on MSDN or TechNet.

谢谢!


这篇关于从2012 Express Userform将数据发送到Sql表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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