需要帮助选择@@ Identity [英] Need Help with Select @@ Identity

查看:64
本文介绍了需要帮助选择@@ Identity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用带有formview控件的VS 2005尝试向我的访问数据库插入一条记录

。数据提交到主表没问题,

但是我需要将catID带到桥表CatalogImage,其中还需要放置

imgID。


以下是使用Select @@ Identity

携带catID的代码,并将imgID插入桥接表。


没有数据输入桥牌表。


非常感谢你的帮助。


TRU


> Imports System.Data.OleDb
Partial class adminMarcell_CatalogAdd

继承System.Web.UI.Page


Protected Sub FormView1_ItemInserted(ByVal sender As Object,ByVal e As System.Web.UI.WebControls.FormViewInsertedEventArg s)Handles FormView1.ItemInserted


''Declare&定义连接字符串

Dim strConn As String =" Provider = Microsoft.Jet.OLEDB.4.0;数据来源= &安培; Server.MapPath("〜/ App_Data / MarcellCatalog.mdb")

''声明&定义SQL

Dim strSQL As String =" SELECT @@ Identity"


''用连接字符串创建连接对象

Dim Conn As New OleDbConnection(strConn)


''用SQL和连接命令创建命令对象

Dim Cmd As New OleDbCommand(strSQL,Conn)


''声明&为新id值定义变量

Dim newId As Integer

Conn.Open()


''执行命令并传递返回结果为newId

newId = Cmd.ExecuteScalar()

Conn.Close()


''声明和定义使用参数标记的新SQL语句(?)

Dim strSQL2 As String =" Insert into CATALOGIMAGE(CatID,ImgID)Values(" newId&",?)"

Dim Cmd2作为新的OleDbCommand(strSQL2,Conn)


''将参数添加到命令中,并指定其来源

' '使用FindControl引用DropDownList()

Dim ddl As DropDownList = CType(FormView1.FindControl(" ImageDropDown"),DropDownList)


''这个是下拉列表'的selectedValue

Cmd2.Parameters.AddWithValue("",ddl.SelectedValue)

Conn.Open()


''执行SQL来插入值

Cmd.ExecuteNonQuery()

Conn.Close ()


End Sub
End Class

解决方案



首先,您需要了解SELECT @@ IDENTITY;是一个特定于

连接的命令。这意味着如果您将两个连接连接到

数据库,则在表中插入一行并使用

不同的连接运行此命令,结果会有所不同。 />

所以你应该做以下事情来解决你的问题:

1.创建一个数据库连接。

2.创建一个命令对象。

3.打开连接。

4.插入一行

5.执行SELECT @@ IDENTITY没有关闭或创建新连接

6 ..执行其余步骤。

以下行的另一个问题是newId = Cmd.ExecuteScalar( )" 。

newId是整数,ExecuteScalar()返回一个对象。使用需要将

转换为整数。你可以做这样的事情

Int32.Parse(Cmd.ExecuteScalar()。ToString())。


我希望这能解决你的问题。如果有任何困难,请随时回来。


问候,

Tushar

" PinkBishop"写道:


>

我正在使用VS 2005与formview控件试图插入记录

到我的访问数据库。数据提交到主表没问题,

但是我需要将catID带到桥表CatalogImage,其中还需要放置

imgID。


以下是使用Select @@ Identity

携带catID的代码,并将imgID插入桥接表。


没有数据输入桥牌表。


非常感谢你的帮助。


TRU


导入System.Data.OleDb

部分类adminMarcell_CatalogAdd

继承System.Web.UI.Page


受保护的子FormView1_ItemInserted(ByVal sender As Object,ByVal e As System.Web.UI.WebControls.FormViewInsertedEventArg s)Handles FormView1.ItemInserted

''Declare&定义连接字符串

Dim strConn As String =" Provider = Microsoft.Jet.OLEDB.4.0;数据来源= &安培; Server.MapPath("〜/ App_Data / MarcellCatalog.mdb")

''声明&定义SQL

Dim strSQL As String =" SELECT @@ Identity"


''用连接字符串创建连接对象

Dim Conn As New OleDbConnection(strConn)


''用SQL和连接命令创建命令对象

Dim Cmd As New OleDbCommand(strSQL,Conn)


''声明&为新id值定义变量

Dim newId As Integer

Conn.Open()


''执行命令并传递返回结果为newId

newId = Cmd.ExecuteScalar()

Conn.Close()


''声明和定义使用参数标记的新SQL语句(?)

Dim strSQL2 As String =" Insert into CATALOGIMAGE(CatID,ImgID)Values(" newId&",?)"

Dim Cmd2作为新的OleDbCommand(strSQL2,Conn)


''将参数添加到命令中,并指定其来源

' '使用FindControl引用DropDownList()

Dim ddl As DropDownList = CType(FormView1.FindControl(" ImageDropDown"),DropDownList)


''这个是下拉列表'的selectedValue

Cmd2.Parameters.AddWithValue(",",ddl.SelectedVa) lue)

Conn.Open()


''执行SQL来插入值

Cmd.ExecuteNonQuery()

Conn.Close()


结束子

结束类




首先让我说我是VS和.Net的新手。我想我已经用双脚跳进去完成第一个项目了。用这个

表格作为项目的最后一部分。


除非我不理解你,这是一个很好的可能性,我相信

我已经完成了你的清单的前四项。用我的表格

页面。如下所述,我可以使用我的表单将我的数据提交到

第一个表中。我希望通过另一个

板的帮助,执行select @@ identity后面的代码会将

catID和imgID传递给桥接表。不是步骤5背后的代码

和6?


谢谢,


TRU


2007年4月14日星期六21:38:04 -0700,Tushar

< Tu **** @ discussion.microsoft.comwrote:


>
首先,您需要了解SELECT @@ IDENTITY;是一个特定于
连接的命令。这意味着如果您连接到
数据库,在表中插入一行并使用
不同的连接运行此命令,结果会有所不同。

所以你应该做以下事情来解决你的问题:
1。创建数据库连接。
2。创建一个命令对象。
3。打开连接。
4。插入一行
5。执行SELECT @@ IDENTITY没有关闭或创建新连接
6 ..执行其余步骤。

以下行的另一个问题是newId = Cmd.ExecuteScalar() 。
newId是整数,ExecuteScalar()返回一个对象。使用需要将
转换为整数。你可以做这样的事情
Int32.Parse(Cmd.ExecuteScalar()。ToString())。

我希望这能解决你的问题。如果遇到任何困难,请随时回来。

问候,
Tushar
PinkBishop写道:


>>
我正在使用VS 2005与formview控件试图在我的访问数据库中插入一条记录。数据提交到主表没问题,
但我需要将catID带到桥表CatalogImage,其中还需要放置
imgID。

以下是我的后面的代码使用Select @@ Identity
传送catID并将imgID插入桥接表。

没有数据输入桥接表。

非常感谢您的帮助。

TRU


> Imports System.Data.OleDb
Partial class adminMarcell_CatalogAdd

继承System.Web.UI.Page

受保护的子FormView1_ItemInserted(ByVal sender As Object,ByVal e As System.Web.UI.WebControls.FormViewInsertedEventArg s)处理FormView1。 ItemInserted


''声明&定义连接字符串

Dim strConn As String =" Provider = Microsoft.Jet.OLEDB.4.0;数据来源= &安培; Server.MapPath("〜/ App_Data / MarcellCatalog.mdb")

''声明&定义SQL

Dim strSQL As String =" SELECT @@ Identity"


''用连接字符串创建连接对象

Dim Conn As New OleDbConnection(strConn)


''用SQL和连接命令创建命令对象

Dim Cmd As New OleDbCommand(strSQL,Conn)


''声明&为新id值定义变量

Dim newId As Integer

Conn.Open()


''执行命令并传递返回结果为newId

newId = Cmd.ExecuteScalar()

Conn.Close()


''声明和定义使用参数标记的新SQL语句(?)

Dim strSQL2 As String =" Insert into CATALOGIMAGE(CatID,ImgID)Values(" newId&",?)"

Dim Cmd2作为新的OleDbCommand(strSQL2,Conn)


''将参数添加到命令中,并指定其来源

' '使用FindControl引用DropDownList()

Dim ddl As DropDownList = CType(FormView1.FindControl(" ImageDropDown"),DropDownList)


''这个是下拉列表'的selectedValue

Cmd2.Parameters.AddWithValue("",ddl.SelectedValue)

Conn.Open()


''执行SQL来插入值

Cmd.ExecuteNonQuery()

Conn.Close ()


End Sub
End Class


你好

没关系。你很快就会知道的。

你是对的。您执行了步骤1-4,然后执行了5-6。但问题是

所有这些步骤都应该在一个连接中执行。

从您编写的代码中我感觉就是你

打开连接

执行步骤1-4

关闭连接


打开连接

执行步骤5-6 ......

关闭连接


在这种情况下,select @@ IDENTITY不会工作,因为它是连接

具体。所有步骤都需要在一个连接下执行

对象。

已经插入项目时执行了步骤5-6。

当您创建与数据库的新连接时,SELECT @@ IDENTITY并不是
工作。它不知道最后插入了哪个值。


只需一次尝试执行所有这些步骤,我相信它会给你带来
工作。即便如此,如果你遇到问题,请随时回复我。我会

通过邮件或聊天向你解释。

-

问候,

Tushar

MCTS - .NET 2.0 Web App

" PinkBishop"写道:


>

首先让我说我是VS和.Net的新手。我想我已经用双脚跳进去完成第一个项目了。用这个

表格作为项目的最后一部分。


除非我不理解你,这是一个很好的可能性,我相信

我已经完成了你的清单的前四项。用我的表格

页面。如下所述,我可以使用我的表单将我的数据提交到

第一个表中。我希望通过另一个

板的帮助,执行select @@ identity后面的代码会将

catID和imgID传递给桥接表。不是步骤5背后的代码

和6?


谢谢,


TRU


2007年4月14日星期六21:38:04 -0700,Tushar

< Tu **** @ discussion.microsoft.comwrote:




首先,您需要了解SELECT @@ IDENTITY;是一个特定于

连接的命令。这意味着如果您将两个连接连接到

数据库,则在表中插入一行并使用

不同的连接运行此命令,结果会有所不同。 />

所以你应该做以下事情来解决你的问题:

1.创建一个数据库连接。

2.创建一个命令对象。

3.打开连接。

4.插入一行

5.执行SELECT @@ IDENTITY没有关闭或创建新连接

6 ..执行其余步骤。

以下行的另一个问题是newId = Cmd.ExecuteScalar( )" 。

newId是整数,ExecuteScalar()返回一个对象。使用需要将

转换为整数。你可以做这样的事情

Int32.Parse(Cmd.ExecuteScalar()。ToString())。


我希望这能解决你的问题。如果有任何困难,请随时回来。


问候,

Tushar

" PinkBishop"写道:


>

我正在使用VS 2005与formview控件试图插入记录

到我的访问数据库。数据提交到主表没问题,

但是我需要将catID带到桥表CatalogImage,其中还需要放置

imgID。


以下是使用Select @@ Identity

携带catID的代码,并将imgID插入桥接表。


没有数据输入桥牌表。


非常感谢您的帮助。


TRU

导入System.Data.OleDb

部分类adminMarcell_CatalogAdd

继承System.Web.UI.Page


受保护的子FormView1_ItemInserted(ByVal sender As Object,ByVal e As System.Web.UI.WebControls.FormViewInsertedEventArg s)Handles FormView1.ItemInserted

''Declare&定义连接字符串

Dim strConn As String =" Provider = Microsoft.Jet.OLEDB.4.0;数据来源= &安培; Server.MapPath("〜/ App_Data / MarcellCatalog.mdb")

''声明&定义SQL

Dim strSQL As String =" SELECT @@ Identity"


''用连接字符串创建连接对象

Dim Conn As New OleDbConnection(strConn)


''用SQL和连接命令创建命令对象

Dim Cmd As New OleDbCommand(strSQL,Conn)


''声明&为新id值定义变量

Dim newId As Integer

Conn.Open()


''执行命令并传递返回结果为newId

newId = Cmd.ExecuteScalar()

Conn.Close()


''声明和定义使用参数标记的新SQL语句(?)

Dim strSQL2 As String =" Insert into CATALOGIMAGE(CatID,ImgID)Values(" newId&",?)"

Dim Cmd2作为新的OleDbCommand(strSQL2,Conn)


''将参数添加到命令中,并指定其来源

' '使用FindControl引用DropDownList()

Dim ddl As DropDownList = CType(FormView1.FindControl(" ImageDropDown"),DropDownList)


''这个是下拉列表'的selectedValue

Cmd2.Parameters.AddWithValue(",",ddl.SelectedVa) lue)

Conn.Open()


''执行SQL来插入值

Cmd.ExecuteNonQuery()

Conn.Close()


结束子

结束班



I am using VS 2005 with a formview control trying to insert a record
to my access db. The data is submitted to the main table no problem,
but I need to carry the catID to the bridge table CatalogImage where
imgID also needs to be placed.

Below is my code behind to carry the catID using the Select @@Identity
and insert imgID to the bridge table.

No data is being entered into the bridge table.

Your help is greatly appreciated.

TRU

>Imports System.Data.OleDb
Partial Class adminMarcell_CatalogAdd
Inherits System.Web.UI.Page

Protected Sub FormView1_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertedEventArg s) Handles FormView1.ItemInserted
''Declare & Define Connection string
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("~/App_Data/MarcellCatalog.mdb")
''Declare & Define SQL
Dim strSQL As String = "SELECT @@Identity"

''Create connection object with connection string
Dim Conn As New OleDbConnection(strConn)

''Create command object with SQL and connection oject
Dim Cmd As New OleDbCommand(strSQL, Conn)

''Declare & Define variable for new id value
Dim newId As Integer
Conn.Open()

''Execute the command and pass the returend result to newId
newId = Cmd.ExecuteScalar()
Conn.Close()

''Declare and Define new SQL statement using parameter marker (?)
Dim strSQL2 As String = "Insert into CATALOGIMAGE (CatID, ImgID) Values (" & newId & ",?)"
Dim Cmd2 As New OleDbCommand(strSQL2, Conn)

''Add the parameter to the command, and specify its source
''Reference the DropDownList using FindControl()
Dim ddl As DropDownList = CType(FormView1.FindControl("ImageDropDown"), DropDownList)

''This is the dropdownlist''s selectedValue
Cmd2.Parameters.AddWithValue("", ddl.SelectedValue)
Conn.Open()

''Execute the SQL to insert the values
Cmd.ExecuteNonQuery()
Conn.Close()

End Sub
End Class

解决方案

Hi ,
First of all you need to understand that "SELECT @@IDENTITY " is a
connection specific command. It means that if you take two connections to the
database , Insert a single row in a table and run this command using
different connections the result would be different.

So you should do the following to solve your problem :
1. Create a database connection.
2. Create a command object.
3. Open the connection.
4. Insert a row
5. Execute "SELECT @@IDENTITY " without closing or creating a new connection
6.. Performs rest of the steps as you were doing.
Another problem with the following line "newId = Cmd.ExecuteScalar()" .
newId is integer and ExecuteScalar() returns an object. Use need to convert
that to integer. You can do something like this
Int32.Parse(Cmd.ExecuteScalar().ToString()) .

I hope this solves your problem. Feel free to get back in case of any
difficulties.

Regards,
Tushar
"PinkBishop" wrote:

>
I am using VS 2005 with a formview control trying to insert a record
to my access db. The data is submitted to the main table no problem,
but I need to carry the catID to the bridge table CatalogImage where
imgID also needs to be placed.

Below is my code behind to carry the catID using the Select @@Identity
and insert imgID to the bridge table.

No data is being entered into the bridge table.

Your help is greatly appreciated.

TRU

Imports System.Data.OleDb
Partial Class adminMarcell_CatalogAdd
Inherits System.Web.UI.Page

Protected Sub FormView1_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertedEventArg s) Handles FormView1.ItemInserted
''Declare & Define Connection string
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("~/App_Data/MarcellCatalog.mdb")
''Declare & Define SQL
Dim strSQL As String = "SELECT @@Identity"

''Create connection object with connection string
Dim Conn As New OleDbConnection(strConn)

''Create command object with SQL and connection oject
Dim Cmd As New OleDbCommand(strSQL, Conn)

''Declare & Define variable for new id value
Dim newId As Integer
Conn.Open()

''Execute the command and pass the returend result to newId
newId = Cmd.ExecuteScalar()
Conn.Close()

''Declare and Define new SQL statement using parameter marker (?)
Dim strSQL2 As String = "Insert into CATALOGIMAGE (CatID, ImgID) Values (" & newId & ",?)"
Dim Cmd2 As New OleDbCommand(strSQL2, Conn)

''Add the parameter to the command, and specify its source
''Reference the DropDownList using FindControl()
Dim ddl As DropDownList = CType(FormView1.FindControl("ImageDropDown"), DropDownList)

''This is the dropdownlist''s selectedValue
Cmd2.Parameters.AddWithValue("", ddl.SelectedValue)
Conn.Open()

''Execute the SQL to insert the values
Cmd.ExecuteNonQuery()
Conn.Close()

End Sub
End Class



Let me start by saying I am very new to VS and .Net. I guess i am
jumping in with both feet to complete this first project. With this
form to be the last part of the project.

Unless I do not understand you, which is a good possiblity, I believe
I have accomplished the first four items of your list. with my form
page. As explained below, I am able to get my data submitted into the
first table with my form. It was my hope through help from another
board that a code behind doing the select @@identity would pass the
catID and imgID to the bridge table. Isn''t the code behind steps 5
and 6?

Thanks,

TRU

On Sat, 14 Apr 2007 21:38:04 -0700, Tushar
<Tu****@discussions.microsoft.comwrote:

>Hi ,
First of all you need to understand that "SELECT @@IDENTITY " is a
connection specific command. It means that if you take two connections to the
database , Insert a single row in a table and run this command using
different connections the result would be different.

So you should do the following to solve your problem :
1. Create a database connection.
2. Create a command object.
3. Open the connection.
4. Insert a row
5. Execute "SELECT @@IDENTITY " without closing or creating a new connection
6.. Performs rest of the steps as you were doing.
Another problem with the following line "newId = Cmd.ExecuteScalar()" .
newId is integer and ExecuteScalar() returns an object. Use need to convert
that to integer. You can do something like this
Int32.Parse(Cmd.ExecuteScalar().ToString()) .

I hope this solves your problem. Feel free to get back in case of any
difficulties.

Regards,
Tushar
"PinkBishop" wrote:

>>
I am using VS 2005 with a formview control trying to insert a record
to my access db. The data is submitted to the main table no problem,
but I need to carry the catID to the bridge table CatalogImage where
imgID also needs to be placed.

Below is my code behind to carry the catID using the Select @@Identity
and insert imgID to the bridge table.

No data is being entered into the bridge table.

Your help is greatly appreciated.

TRU

>Imports System.Data.OleDb
Partial Class adminMarcell_CatalogAdd
Inherits System.Web.UI.Page

Protected Sub FormView1_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertedEventArg s) Handles FormView1.ItemInserted
''Declare & Define Connection string
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("~/App_Data/MarcellCatalog.mdb")
''Declare & Define SQL
Dim strSQL As String = "SELECT @@Identity"

''Create connection object with connection string
Dim Conn As New OleDbConnection(strConn)

''Create command object with SQL and connection oject
Dim Cmd As New OleDbCommand(strSQL, Conn)

''Declare & Define variable for new id value
Dim newId As Integer
Conn.Open()

''Execute the command and pass the returend result to newId
newId = Cmd.ExecuteScalar()
Conn.Close()

''Declare and Define new SQL statement using parameter marker (?)
Dim strSQL2 As String = "Insert into CATALOGIMAGE (CatID, ImgID) Values (" & newId & ",?)"
Dim Cmd2 As New OleDbCommand(strSQL2, Conn)

''Add the parameter to the command, and specify its source
''Reference the DropDownList using FindControl()
Dim ddl As DropDownList = CType(FormView1.FindControl("ImageDropDown"), DropDownList)

''This is the dropdownlist''s selectedValue
Cmd2.Parameters.AddWithValue("", ddl.SelectedValue)
Conn.Open()

''Execute the SQL to insert the values
Cmd.ExecuteNonQuery()
Conn.Close()

End Sub
End Class


Hi
It''s ok. You will learn soon.
You are right . You performed steps 1-4 and then 5-6. But the problem is
that all these steps should be performed in a single connection.
From the code that you have written what i feel is that you
open a connection
perform steps 1-4
close a connection

open a connection
perform steps 5-6...
close the connection

In this case "select @@IDENTITY" won''t work because it is connection
specific. All the steps need to be performed under a single connection
object.
The steps 5-6 are been performed when the item has already been inserted.
When you create a new connection to the database , SELECT @@IDENTITY doesn''t
work. It doesn''t know which value was inserted last.

Just try and perform all these steps in a single go and I am sure it''ll
work. Even then if you face a problem feel free to get back to me. I''ll
explain it to you through mail or chat.
--
Regards,
Tushar
MCTS - .NET 2.0 Web App
"PinkBishop" wrote:

>
Let me start by saying I am very new to VS and .Net. I guess i am
jumping in with both feet to complete this first project. With this
form to be the last part of the project.

Unless I do not understand you, which is a good possiblity, I believe
I have accomplished the first four items of your list. with my form
page. As explained below, I am able to get my data submitted into the
first table with my form. It was my hope through help from another
board that a code behind doing the select @@identity would pass the
catID and imgID to the bridge table. Isn''t the code behind steps 5
and 6?

Thanks,

TRU

On Sat, 14 Apr 2007 21:38:04 -0700, Tushar
<Tu****@discussions.microsoft.comwrote:

Hi ,
First of all you need to understand that "SELECT @@IDENTITY " is a
connection specific command. It means that if you take two connections to the
database , Insert a single row in a table and run this command using
different connections the result would be different.

So you should do the following to solve your problem :
1. Create a database connection.
2. Create a command object.
3. Open the connection.
4. Insert a row
5. Execute "SELECT @@IDENTITY " without closing or creating a new connection
6.. Performs rest of the steps as you were doing.
Another problem with the following line "newId = Cmd.ExecuteScalar()" .
newId is integer and ExecuteScalar() returns an object. Use need to convert
that to integer. You can do something like this
Int32.Parse(Cmd.ExecuteScalar().ToString()) .

I hope this solves your problem. Feel free to get back in case of any
difficulties.

Regards,
Tushar
"PinkBishop" wrote:

>
I am using VS 2005 with a formview control trying to insert a record
to my access db. The data is submitted to the main table no problem,
but I need to carry the catID to the bridge table CatalogImage where
imgID also needs to be placed.

Below is my code behind to carry the catID using the Select @@Identity
and insert imgID to the bridge table.

No data is being entered into the bridge table.

Your help is greatly appreciated.

TRU

Imports System.Data.OleDb
Partial Class adminMarcell_CatalogAdd
Inherits System.Web.UI.Page

Protected Sub FormView1_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertedEventArg s) Handles FormView1.ItemInserted
''Declare & Define Connection string
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("~/App_Data/MarcellCatalog.mdb")
''Declare & Define SQL
Dim strSQL As String = "SELECT @@Identity"

''Create connection object with connection string
Dim Conn As New OleDbConnection(strConn)

''Create command object with SQL and connection oject
Dim Cmd As New OleDbCommand(strSQL, Conn)

''Declare & Define variable for new id value
Dim newId As Integer
Conn.Open()

''Execute the command and pass the returend result to newId
newId = Cmd.ExecuteScalar()
Conn.Close()

''Declare and Define new SQL statement using parameter marker (?)
Dim strSQL2 As String = "Insert into CATALOGIMAGE (CatID, ImgID) Values (" & newId & ",?)"
Dim Cmd2 As New OleDbCommand(strSQL2, Conn)

''Add the parameter to the command, and specify its source
''Reference the DropDownList using FindControl()
Dim ddl As DropDownList = CType(FormView1.FindControl("ImageDropDown"), DropDownList)

''This is the dropdownlist''s selectedValue
Cmd2.Parameters.AddWithValue("", ddl.SelectedValue)
Conn.Open()

''Execute the SQL to insert the values
Cmd.ExecuteNonQuery()
Conn.Close()

End Sub
End Class


这篇关于需要帮助选择@@ Identity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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