将数据添加到表中 [英] Adding data to table

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

问题描述

嘿,


我想在微软网站上做这个教程:
http://msdn.microsoft.com/library/default.asp?

url = / library / en-us / dndotnet / html / usingadonet.asp


我可以把所有东西都用到DataAdd部分

(章节标题是向数据集添加行)


我在为DataAdd()程序添加了所有

代码后,我真的不知道该怎么做。除了DataAdd

()之外我想要它使用的按钮。


我不知道把INSERT SQL语句放到哪里或添加

数据集中数据表的新行。


同样在DataAdd()程序的主代码中

是一个像这样的行:


oBuild =新的SqlClient.SqlDataAdapter(oAdapter)


有谁知道我为什么得到:
的价值
类型''System.Data.SqlClient.SqlDataAdapter''不能将
转换为''System.Data.SqlClient.SqlCommand''。


???

对此的任何帮助都将非常感激。


谢谢。

解决方案

错误是b / c oBuild是一种与

sqldataadapter不同且不兼容的类型。它是一个sqlcommand对象。它就像是说这是一个

苹果......把它变成橙色。


史蒂夫

" Trevor" < TJ ** @ bigpond.net.au>在消息中写道

news:06 **************************** @ phx.gbl ... < blockquote class =post_quotes>嘿,

我想在microsoft网站上做这个教程:
http://msdn.microsoft.com/library/default.asp?
url = / library / en-us / dndotnet / html / usingadonet.asp

我可以把所有东西都用到DataAdd部分
(章节标题是向数据集添加行)

我添加了所有的东西之后我真的不知道该怎么做
DataAdd()过程的代码。除了DataAdd
()之外我想要它使用的按钮。

我不知道把INSERT SQL语句放在哪里或者将新行添加到数据表中在数据集中。

在DataAdd()过程的主要代码中,
是这样的一行:

oBuild =新的SqlClient.SqlDataAdapter(oAdapter) )

有谁知道我得到的原因:
类型'System.Data.SqlClient.SqlDataAdapter''的值不能转换为''System.Data.SqlClient。 SqlCommand''。

???

任何对此的帮助都将非常感激。

谢谢。


好的,我该怎么办?


我用的是什么?


代码是microsofts。

-----原始消息-----
错误是b / c oBuild是一个不同的和
不兼容的类型比asqldataadapter。它是一个sqlcommand对象。这就像
说的那样这是anapple ...把​​它变成橙色。

史蒂夫

Trevor < TJ ** @ bigpond.net.au>在消息中写道
新闻:06 **************************** @ phx.gbl ...

嘿,

我试图在微软网站上做这个教程:
http://msdn.microsoft.com/library/default.asp?
url = / library / en-us / dndotnet / html / usingadonet.asp

我可以得到一切来处理DataAdd部分
(章节标题是向数据集添加行)

我添加所有$后我真的不知道该怎么做b $ b DataAdd()过程的代码。除了我希望它使用的按钮的
DataAdd()之外。

我不知道将INSERT SQL语句放在哪里或
将新行添加到数据表在数据集中。

在DataAdd()过程的主要代码中,
是这样的一行:

oBuild =新的SqlClient.SqlDataAdapter(oAdapter) )

有谁知道我得到的原因:
类型'System.Data.SqlClient.SqlDataAdapter''的值不能转换为''System.Data.SqlClient。 SqlCommand''。

???

任何对此的帮助都将非常感激。

谢谢。




请发布您的代码。


" Trevor" < TJ ** @ bigpond.net.au>在留言中写道

news:0c **************************** @ phx.gbl ... < blockquote class =post_quotes>好的,我该怎么办?

我用的是什么?

代码是microsofts。

-----原始消息-----
错误是b / c oBuild与


不兼容> SqlDataAdapter的。它是一个sqlcommand对象。它就像


说这是一个

apple ...把​​它变成橙色。

史蒂夫

" Trevor" < TJ ** @ bigpond.net.au>在消息中写道
新闻:06 **************************** @ phx.gbl ...

嘿,

我试图在微软网站上做这个教程:
http://msdn.microsoft.com/library/default.asp?
url = / library / en-us / dndotnet / html / usingadonet.asp

我可以把所有东西都用到DataAdd部分
(章节标题是向数据集添加行)

我添加了所有的东西之后我真的不知道该怎么做DataAdd()过程的代码。除了我希望它使用的按钮的DataAdd()之外。

我不知道在哪里放置INSERT SQL语句或将新行添加到数据集中的数据表。

同样在DataAdd()程序的主要代码那里
就是这样一行:

oBuild =新的SqlClient.SqlDataAdapter(oAdapter)

>有谁知道我得到的原因:
类型的值''System.Data.SqlClient.SqlDataAdapter''无法转换为''System.Data.SqlClient.SqlCommand''。

???

对此的任何帮助都将非常感激。

谢谢。





Hey,

I am trying to do this tutorial on the microsoft site :
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dndotnet/html/usingadonet.asp

I can get everything to work up to the DataAdd part
(Section heading is Adding Rows to a DataSet)

I dont really know what to do after i have added all the
code for the DataAdd() procedure. Other than the DataAdd
() for the button that i want it to use.

I dont know where to put that INSERT SQL Statement or add
the new row to the datatable in the dataset.

Also in that main code of the DataAdd() procedure there
is a line like this:

oBuild = New SqlClient.SqlDataAdapter(oAdapter)

Does anyone know why i get : Value of
type ''System.Data.SqlClient.SqlDataAdapter'' cannot be
converted to ''System.Data.SqlClient.SqlCommand''.

???
Any help on this would be much appreciated.

Thank you.

解决方案

the error is b/c oBuild is of a different and incompatible type than a
sqldataadapter. it is a sqlcommand object. it''s like saying "this is an
apple...make it into an orange."

steve
"Trevor" <tj**@bigpond.net.au> wrote in message
news:06****************************@phx.gbl...

Hey,

I am trying to do this tutorial on the microsoft site :
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dndotnet/html/usingadonet.asp

I can get everything to work up to the DataAdd part
(Section heading is Adding Rows to a DataSet)

I dont really know what to do after i have added all the
code for the DataAdd() procedure. Other than the DataAdd
() for the button that i want it to use.

I dont know where to put that INSERT SQL Statement or add
the new row to the datatable in the dataset.

Also in that main code of the DataAdd() procedure there
is a line like this:

oBuild = New SqlClient.SqlDataAdapter(oAdapter)

Does anyone know why i get : Value of
type ''System.Data.SqlClient.SqlDataAdapter'' cannot be
converted to ''System.Data.SqlClient.SqlCommand''.

???
Any help on this would be much appreciated.

Thank you.



Ok so what do i do?

What do i use instead?

The code is microsofts.

-----Original Message-----
the error is b/c oBuild is of a different and incompatible type than asqldataadapter. it is a sqlcommand object. it''s like saying "this is anapple...make it into an orange."

steve
"Trevor" <tj**@bigpond.net.au> wrote in message
news:06****************************@phx.gbl...

Hey,

I am trying to do this tutorial on the microsoft site :
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dndotnet/html/usingadonet.asp

I can get everything to work up to the DataAdd part
(Section heading is Adding Rows to a DataSet)

I dont really know what to do after i have added all the code for the DataAdd() procedure. Other than the DataAdd () for the button that i want it to use.

I dont know where to put that INSERT SQL Statement or add the new row to the datatable in the dataset.

Also in that main code of the DataAdd() procedure there
is a line like this:

oBuild = New SqlClient.SqlDataAdapter(oAdapter)

Does anyone know why i get : Value of
type ''System.Data.SqlClient.SqlDataAdapter'' cannot be
converted to ''System.Data.SqlClient.SqlCommand''.

???
Any help on this would be much appreciated.

Thank you.


.



Please post your code as you have it.

"Trevor" <tj**@bigpond.net.au> wrote in message
news:0c****************************@phx.gbl...

Ok so what do i do?

What do i use instead?

The code is microsofts.

-----Original Message-----
the error is b/c oBuild is of a different and


incompatible type than a

sqldataadapter. it is a sqlcommand object. it''s like


saying "this is an

apple...make it into an orange."

steve
"Trevor" <tj**@bigpond.net.au> wrote in message
news:06****************************@phx.gbl...

Hey,

I am trying to do this tutorial on the microsoft site :
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dndotnet/html/usingadonet.asp

I can get everything to work up to the DataAdd part
(Section heading is Adding Rows to a DataSet)

I dont really know what to do after i have added all the code for the DataAdd() procedure. Other than the DataAdd () for the button that i want it to use.

I dont know where to put that INSERT SQL Statement or add the new row to the datatable in the dataset.

Also in that main code of the DataAdd() procedure there
is a line like this:

oBuild = New SqlClient.SqlDataAdapter(oAdapter)

Does anyone know why i get : Value of
type ''System.Data.SqlClient.SqlDataAdapter'' cannot be
converted to ''System.Data.SqlClient.SqlCommand''.

???
Any help on this would be much appreciated.

Thank you.


.



这篇关于将数据添加到表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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