看你是用什么ConnectionSqlConnection : data = new DataObj("server=localhost;Database=grocertogo;User id=sa;Password=sql");OledbConnection: data = new DataObj("Data Source=localhost;Initial Catalog=grocertogo;User Id=sa;Password=sql");
-->>>Oreilly - C#.Net Programming 2nd Edition //////////////////////////////////////////////////////////////////////////// Visual Studio creates single-module assemblies by default. You can create a multi-module resource with the /addModules command line. The easiest way to compile and build a multimodule assembly is with a makefile, which you can create with Notepad or any text editor. If you are unfamiliar with makefiles, don't worry; this is the only example that needs a makefile, and that is only to get around the current limitation of Visual Studio creating only single-module assemblies. If necessary, you can just use the makefile as offered without fully understanding every line. Example 17-3 shows the complete makefile (which is explained in detail immediately afterward). To run this example, put the makefile (with the name 'makefile') in a directory together with a copy of Calc.cs, Fraction.cs, and AssemblyInfo.cs. Start up a .NET command window and cd to that directory. Invoke nmake without any command switchs. You will find the SharedAssembly.dll in the \bin subdirectory. Programming C#, 2nd Edition 401 Example 17-3. The complete makefile for a multi-module assembly ASSEMBLY= MySharedAssembly.dll BIN=.\bin SRC=. DEST=.\bin CSC=csc /nologo /debug+ /d:DEBUG /d:TRACE MODULETARGET=/t:module LIBTARGET=/t:library EXETARGET=/t:exe REFERENCES=System.dll MODULES=$(DEST)\Fraction.dll $(DEST)\Calc.dll METADATA=$(SRC)\AssemblyInfo.cs all: $(DEST)\MySharedAssembly.dll # Assembly metadata placed in same module as manifest $(DEST)\$(ASSEMBLY): $(METADATA) $(MODULES) $(DEST) $(CSC) $(LIBTARGET) /addmodule:$(MODULES: =;) /out:$@ %s # Add Calc.dll module to this dependency list $(DEST)\Calc.dll: Calc.cs $(DEST) $(CSC) $(MODULETARGET) /r:$(REFERENCES: =;) /out:$@ %s # Add Fraction $(DEST)\Fraction.dll: Fraction.cs $(DEST) $(CSC) $(MODULETARGET) /r:$(REFERENCES: =;) /out:$@ %s $(DEST):: !if !EXISTS($(DEST)) mkdir $(DEST) !endif The makefile begins by defining the assembly you want to build: ASSEMBLY= MySharedAssembly.dll It then defines the directories you'll use, putting the output in a bin directory beneath the current directory and retrieving the source code from the current directory: BIN=.\bin SRC=. DEST=.\bin Build the assembly as follows: $(DEST)\$(ASSEMBLY): $(METADATA) $(MODULES) $(DEST) $(CSC) $(LIBTARGET) /addmodule:$(MODULES: =;) /out:$@ %s This places the assembly (MySharedAssembly.dll) in the destination directory (bin). It tells nmake (the program that executes the makefile) that the assembly consists of the metadata and the modules, and it provides the command line required to build the assembly. Programming C#, 2nd Edition 402 The metadata is defined earlier as: METADATA=$(SRC)\AssemblyInfo.cs The modules are defined as the two DLLs: MODULES=$(DEST)\Fraction.dll $(DEST)\Calc.dll The compile line builds the library and adds the modules, putting the output into the assembly file MySharedAssembly.dll: $(DEST)\$(ASSEMBLY): $(METADATA) $(MODULES) $(DEST) $(CSC) $(LIBTARGET) /addmodule:$(MODULES: =;) /out:$@ %s To accomplish this, nmake needs to know how to make the modules. Start by telling nmake how to create calc.dll. You need the calc.cs source file for this; tell nmake on the command line to build that DLL: $(DEST)\Calc.dll: Calc.cs $(DEST) $(CSC) $(MODULETARGET) /r:$(REFERENCES: =;) /out:$@ %s Then do the same thing for fraction.dll: $(DEST)\Fraction.dll: Fraction.cs $(DEST) $(CSC) $(MODULETARGET) /r:$(REFERENCES: =;) /out:$@ %s The result of running nmake on this makefile is to create three DLLs: fraction.dll, calc.dll, and MySharedAssembly.dll.
? 晕倒ing I only get the constant :You can create a multi-module resource with the /addModules command line. The easiest way to compile and build a multimodule assembly is with a makefile hope more explain about :=====> Programming C#, 2nd Edition 401 Example 17-3... ...
thank you acewang(龍芯*Inside!): I have download. 那位高人写个中文专题吧(谢了) ----------------------------- 第一个问题又开了一新贴 http://community.csdn.net/Expert/topic/3098/3098939.xml?temp=.4772303
----------------
Provider="Microsoft.Jet.OLEDB.4.0;Data Source=C:\...\JetPassword.MDB;Jet OLEDB:Database Password=MyPwd"
http://support.microsoft.com/default.aspx?scid=kb;en-us;191754
如果原来能访问的话你把localhost改为(local)或127.0.0.1试试看。
data = new DataObj("server=localhost;Database=grocertogo;User id=sa;Password=sql");OledbConnection:
data = new DataObj("Data Source=localhost;Initial Catalog=grocertogo;User Id=sa;Password=sql");
看如下网址也可
http://www.stryon.com.cn/inet/docs/samples/applications/grocer/grocer.htm
安装了quickstart后可看
http://localhost/quickstart/aspplus/samples/grocertogo /CS/grocertogo.aspx
网上可看
http://doc.coder.cn/quickstart/aspplus/doc/businessobjs.aspx#threetier
或者
http://cht.gotdotnet.com/quickstart/servererror.htm?aspxerrorpath=/quickstart/aspplus/samples/webforms/busobjs/VB/ThreeTier.aspx
即可看到该程序的结果。
---------------------------------------------------------------------
安装了quickstart后可看
E:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\QuickStart\aspplus\samples\webforms\busobjs\cs\BusObj.cs[当然路径不一定和您机器上的相同:)]
我是不是要改这个文件,还是其他目录下的文件,
makefile文件也在这个文件目录下,我要问的问题是关于文件路径的,我没说清楚,sorry!
是不是路径问题呢?
[question 1.>]为什么会出错,如何改正
makefile是一个比较关键的文件它指明了dll的生成,引用路径[question 2.>]如何读懂makefile文件,那里有相关资料,望高人告知,如帮组分析最好{thank you}
////////////////////////////////////////////////////////////////////////////
Visual Studio creates single-module assemblies by default. You can create a multi-module
resource with the /addModules command line. The easiest way to compile and build a multimodule
assembly is with a makefile, which you can create with Notepad or any text editor.
If you are unfamiliar with makefiles, don't worry; this is the only
example that needs a makefile, and that is only to get around the
current limitation of Visual Studio creating only single-module
assemblies. If necessary, you can just use the makefile as offered
without fully understanding every line.
Example 17-3 shows the complete makefile (which is explained in detail immediately
afterward). To run this example, put the makefile (with the name 'makefile') in a directory
together with a copy of Calc.cs, Fraction.cs, and AssemblyInfo.cs. Start up a .NET command
window and cd to that directory. Invoke nmake without any command switchs. You will find
the SharedAssembly.dll in the \bin subdirectory.
Programming C#, 2nd Edition
401
Example 17-3. The complete makefile for a multi-module assembly
ASSEMBLY= MySharedAssembly.dll
BIN=.\bin
SRC=.
DEST=.\bin
CSC=csc /nologo /debug+ /d:DEBUG /d:TRACE
MODULETARGET=/t:module
LIBTARGET=/t:library
EXETARGET=/t:exe
REFERENCES=System.dll
MODULES=$(DEST)\Fraction.dll $(DEST)\Calc.dll
METADATA=$(SRC)\AssemblyInfo.cs
all: $(DEST)\MySharedAssembly.dll
# Assembly metadata placed in same module as manifest
$(DEST)\$(ASSEMBLY): $(METADATA) $(MODULES) $(DEST)
$(CSC) $(LIBTARGET) /addmodule:$(MODULES: =;) /out:$@ %s
# Add Calc.dll module to this dependency list
$(DEST)\Calc.dll: Calc.cs $(DEST)
$(CSC) $(MODULETARGET) /r:$(REFERENCES: =;) /out:$@ %s
# Add Fraction
$(DEST)\Fraction.dll: Fraction.cs $(DEST)
$(CSC) $(MODULETARGET) /r:$(REFERENCES: =;) /out:$@ %s
$(DEST)::
!if !EXISTS($(DEST))
mkdir $(DEST)
!endif
The makefile begins by defining the assembly you want to build:
ASSEMBLY= MySharedAssembly.dll
It then defines the directories you'll use, putting the output in a bin directory beneath the
current directory and retrieving the source code from the current directory:
BIN=.\bin
SRC=.
DEST=.\bin
Build the assembly as follows:
$(DEST)\$(ASSEMBLY): $(METADATA) $(MODULES) $(DEST)
$(CSC) $(LIBTARGET) /addmodule:$(MODULES: =;) /out:$@ %s
This places the assembly (MySharedAssembly.dll) in the destination directory (bin). It tells
nmake (the program that executes the makefile) that the assembly consists of the metadata
and the modules, and it provides the command line required to build the assembly.
Programming C#, 2nd Edition
402
The metadata is defined earlier as:
METADATA=$(SRC)\AssemblyInfo.cs
The modules are defined as the two DLLs:
MODULES=$(DEST)\Fraction.dll $(DEST)\Calc.dll
The compile line builds the library and adds the modules, putting the output into the assembly
file MySharedAssembly.dll:
$(DEST)\$(ASSEMBLY): $(METADATA) $(MODULES) $(DEST)
$(CSC) $(LIBTARGET) /addmodule:$(MODULES: =;) /out:$@ %s
To accomplish this, nmake needs to know how to make the modules. Start by telling nmake
how to create calc.dll. You need the calc.cs source file for this; tell nmake on the command
line to build that DLL:
$(DEST)\Calc.dll: Calc.cs $(DEST)
$(CSC) $(MODULETARGET) /r:$(REFERENCES: =;) /out:$@ %s
Then do the same thing for fraction.dll:
$(DEST)\Fraction.dll: Fraction.cs $(DEST)
$(CSC) $(MODULETARGET) /r:$(REFERENCES: =;) /out:$@ %s
The result of running nmake on this makefile is to create three DLLs: fraction.dll, calc.dll,
and MySharedAssembly.dll.
I only get the constant :You can create a multi-module resource with the /addModules command line. The easiest way to compile and build a multimodule
assembly is with a makefile
hope more explain about :=====>
Programming C#, 2nd Edition
401
Example 17-3... ...
http://www.eastasp.com/zh-cn/ebooks/ebook_detail.aspx?bId=7aae982c-7389-4e92-b199-d7c821f2371b
I have download.
那位高人写个中文专题吧(谢了)
-----------------------------
第一个问题又开了一新贴
http://community.csdn.net/Expert/topic/3098/3098939.xml?temp=.4772303
http://warmsun.51.net/article/show.php?id=113
Makefile 基本上就是『目标』(target), 『关连』(dependencies) 和『动作』三者所组成的一连串规则。而 make 就会根据 Makefile 的规则来决定如何编译 (compile) 和连结 (link) 程式。实际上,make 可做的不只是编译和连结程式,例如 FreeBSD 的 port collection 中,Makefile 还可以做到自动下载原始程式套件,解压缩 (extract) ,修补(patch),设定,然後编译,安装至系统中。