困惑的初学者 [英] Confused beginner

查看:50
本文介绍了困惑的初学者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在第一次浏览Visual Studio .Net演练书

来学习一些关于编程的知识。我遇到第一个没有正确运行的第一个

教程的问题。似乎构建失败了

书告诉我的事情。


具体来说,我这样做:

[WebMethod]

公共作者1 GetAuthors()

{

authors1 authors = new Authors1();

sqlDataAdapter1 .Fill(作者);

返回作者;

}


[WebMethod]

public authors1 UpdateAuthors(authors1 authorChanges)

{

if(authorChanges!= null)

{

sqlDataAdapter1.Update (authorChanges);

returen authorChanges;

}

else

返回null;

}

}


我厌倦了把它放在几个不同的地方,但它总是失败?


提前致谢!〜

解决方案



" Blaze" < B1中*** @ discussions.microsoft.com>在消息中写道

新闻:EF ********************************** @ microsof t.com ...

我正在第一次浏览Visual Studio .Net演练
本书,学习一些关于编程的知识。我遇到第一个没有正确运行的教程的问题。似乎构建失败了
本书告诉我要做的事情。


构建时会出现什么错误?

具体来说,我这样做:
[WebMethod]
公共作者1 GetAuthors()
{
authors1 authors = new Authors1();
sqlDataAdapter1.Fill(作者);
返回作者;
}


这看起来有点模糊。


(案例敏感记得) 。试试这个:


public Authors1 GetAuthors()





作者1作者=新作者1 ();


(或者另一种方式,取决于Authors1类的命名方式)

[WebMethod]
公共作者1 UpdateAuthors(authors1 authorChanges)
{
if(authorChanges!= null)
{sqlDataAdapter1.Update(authorChanges);
returen authorChanges;
}
否则
返回null;
}
}


我猜这个(根据以上所述):


public Authors1 UpdateAuthors(作者1 authorChanges)


我厌倦了这几个不同的地方,但它总是失败?

在此先感谢!〜



" Blaze" < B1中*** @ discussions.microsoft.com>在消息中写道

新闻:EF ********************************** @ microsof t.com ...

我正在第一次浏览Visual Studio .Net演练
本书,学习一些关于编程的知识。我遇到第一个没有正确运行的教程的问题。似乎构建失败了
本书告诉我要做的事。

具体来说,我这样做:
[WebMethod]
公开authors1 GetAuthors()
{
authors1 authors = new Authors1();
sqlDataAdapter1.Fill(authors);
返回作者;
}

[WebMethod]
公共作者1 UpdateAuthors(authors1 authorChanges)
{
if(authorChanges!= null)
{sqlDataAdapter1.Update(authorChanges);
returen authorChanges;
}

返回null;
}


我厌倦了把它放在几个不同的地方,但它总是失败吗?

提前致谢!〜




您是否将这些方法decarations放在类声明中?


问候


Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk





" Chance Hopkins"写道:


Blaze < B1中*** @ discussions.microsoft.com>在消息中写道
新闻:EF ********************************** @ microsof t.com。 ..

我正在第一次浏览Visual Studio .Net演练
本书,学习一些关于编程的知识。我遇到第一个没有正确运行的教程的问题。似乎构建失败了
本书告诉我要做的事情。

你在构建时会遇到什么错误?




*****

c:\inetpub \wwwroot \AuthorsWebService \AuthorsServic e.asmx.cs(138):预计

class,delegate,enum,interface或struct

c:\inetpub \wwwroot\AuthorsWebService\AuthorsServic e.asmx.cs(148):预计

class ,委托,枚举,接口或结构

c:\inetpub \wwwroot \AuthorsWebService\AuthorsServic e.asmx.cs(159):输入或

名称空间定义,或预期的文件结束

*****

具体来说,我这样做:
[WebMethod]
public authors1 GetAuthors()
{
authors1 authors = new Authors1();
sqlDataAdapter1.Fill(authors);
return authors;
}


这看起来有点模糊。

(案例敏感的记忆R)。试试这个:

公共作者1 GetAuthors()



作者1作者=新作者1();

(或者另一种方式,取决于Authors1类的命名方式)


[WebMethod]
公共作者1 UpdateAuthors(authors1 authorChanges)
{
if(authorChanges!= null)
{sqlDataAdapter1.Update(authorChanges);
returen authorChanges;
}

返回null;
}
}



我猜这个(基于以上):

公共作者1 UpdateAuthors(作者1) authorChanges)


我厌倦了这几个不同的地方,但它总是失败?

提前致谢! 〜





另外,在你开始新的事情之前,你是否需要申报评论,比如

这个?


blaze


I am doing the first walk through on the Visual Studio .Net walkthrough book
to learn a little about programming. I am having issues with the first
tutorial not running correctly. It seems that the build fails with what the
book tells me to do.

Specifically, I am doing this:
[WebMethod]
public authors1 GetAuthors()
{
authors1 authors = new Authors1();
sqlDataAdapter1.Fill(authors);
return authors;
}

[WebMethod]
public authors1 UpdateAuthors(authors1 authorChanges)
{
if (authorChanges != null)
{
sqlDataAdapter1.Update(authorChanges);
returen authorChanges;
}
else
return null;
}
}

I tired to put this a couple of different places, but it always fails?

Thanks in advance!~

解决方案


"Blaze" <Bl***@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...

I am doing the first walk through on the Visual Studio .Net walkthrough
book
to learn a little about programming. I am having issues with the first
tutorial not running correctly. It seems that the build fails with what
the
book tells me to do.

What errors are you getting when you build?
Specifically, I am doing this:
[WebMethod]
public authors1 GetAuthors()
{
authors1 authors = new Authors1();
sqlDataAdapter1.Fill(authors);
return authors;
}
This looks a bit fuzzy.

(case sensative remember). Try this:

public Authors1 GetAuthors()

and

Authors1 authors = new Authors1();

(or the other way, depending on how the Authors1 class is named)

[WebMethod]
public authors1 UpdateAuthors(authors1 authorChanges)
{
if (authorChanges != null)
{
sqlDataAdapter1.Update(authorChanges);
returen authorChanges;
}
else
return null;
}
}
I''m guessing on this one (based on the above):

public Authors1 UpdateAuthors(Authors1 authorChanges)


I tired to put this a couple of different places, but it always fails?

Thanks in advance!~



"Blaze" <Bl***@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...

I am doing the first walk through on the Visual Studio .Net walkthrough
book
to learn a little about programming. I am having issues with the first
tutorial not running correctly. It seems that the build fails with what
the
book tells me to do.

Specifically, I am doing this:
[WebMethod]
public authors1 GetAuthors()
{
authors1 authors = new Authors1();
sqlDataAdapter1.Fill(authors);
return authors;
}

[WebMethod]
public authors1 UpdateAuthors(authors1 authorChanges)
{
if (authorChanges != null)
{
sqlDataAdapter1.Update(authorChanges);
returen authorChanges;
}
else
return null;
}
}

I tired to put this a couple of different places, but it always fails?

Thanks in advance!~



Are you putting these method decarations inside a class declaration?

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk




"Chance Hopkins" wrote:


"Blaze" <Bl***@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...

I am doing the first walk through on the Visual Studio .Net walkthrough
book
to learn a little about programming. I am having issues with the first
tutorial not running correctly. It seems that the build fails with what
the
book tells me to do.

What errors are you getting when you build?



*****
c:\inetpub\wwwroot\AuthorsWebService\AuthorsServic e.asmx.cs(138): Expected
class, delegate, enum, interface, or struct
c:\inetpub\wwwroot\AuthorsWebService\AuthorsServic e.asmx.cs(148): Expected
class, delegate, enum, interface, or struct
c:\inetpub\wwwroot\AuthorsWebService\AuthorsServic e.asmx.cs(159): Type or
namespace definition, or end-of-file expected
*****

Specifically, I am doing this:
[WebMethod]
public authors1 GetAuthors()
{
authors1 authors = new Authors1();
sqlDataAdapter1.Fill(authors);
return authors;
}



This looks a bit fuzzy.

(case sensative remember). Try this:

public Authors1 GetAuthors()

and

Authors1 authors = new Authors1();

(or the other way, depending on how the Authors1 class is named)


[WebMethod]
public authors1 UpdateAuthors(authors1 authorChanges)
{
if (authorChanges != null)
{
sqlDataAdapter1.Update(authorChanges);
returen authorChanges;
}
else
return null;
}
}



I''m guessing on this one (based on the above):

public Authors1 UpdateAuthors(Authors1 authorChanges)


I tired to put this a couple of different places, but it always fails?

Thanks in advance!~




Also, do you have to declare a comment before you start something new like
this?

blaze


这篇关于困惑的初学者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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