2000-12-12· crystal译 ·yesky
asp.net支持多种语言,它的缺省语言将是:visual basic而不是vbscript,这意味着我们可以摆脱vbscript的语言限
制,我们的代码将是编译后运行的(而不是原来的解释执行)。
visual basic
让vbscript 一边去吧。asp现在全部用成熟的vb语言来书写。感觉还不错,不是吗?不过,vb有了一些改动。vb中的
主要改变,不再有set & let,不再有缺省属性,parenthesis现在被称为subs,arguments需通过缺省设置来实现
byval,integer 为32位,long为64位,and" and "or“ 省略了,通过上面的清单不难发现,vb的许多变动是有实际意义的,
也是有明显进步的。
不过,通过上面这些变动却不能改变一个事实,你许多现有的代码将不会正常运作。
我们先看个完整的查询的例子,这个例子也显示了当查询显示没有纪录返回和如何检测返回null数据的情况
<%@ outputcache duration="240"%>
<%--
the above outputcache directive is pretty slick
it means that for 240 seconds (4 minutes) the page will only read the database once
only the first user hitting it forces a database read
--%>
<%@ import namespace="system.data" %>
<%@ import namespace="system.data.ado" %>
<script language="vb" runat="server">
sub page_load(src as object, e as eventargs)
dim ds as dataset
dim myconnection as adoconnection
dim mycommand as adodatasetcommand
dim strconn as string
dim strsql as string
strconn="dsn=student;uid=student;pwd=magic;database=student"
strsql="select * from publishers where state="ny""
myconnection = new adoconnection(strconn)
mycommand = new adodatasetcommand(strsql,myconnection)
ds = new dataset()
mycommand.filldataset(ds, "publishers")
mydatagrid.datasource=ds.tables("publishers").defaultview
mydatagrid.databind()
end sub
</script>
<html><head>
<title>grid of new york data</title>
</head>
<body bgcolor="#ffffff">
<h3><font face="verdana">new york data</font></h3>
<asp:datagrid id="mydatagrid" runat="server"
width="100%"
backcolor="white"
bordercolor="black"
showfooter="false"
cellpadding=3
cellspacing="0"
font-name="verdana"
font-size="8pt"
headerstyle-backcolor="lightblue"
headerstyle-font-size="10pt"
headerstyle-font-style="bold"
maintainstate="false"
/>
</body></html>
c# (c sharp)
c # 非常“酷”,这儿有个双关语,在微软的内部代码名称里,c#就被称为 “酷”(具体语法将另文介绍)。如果你
是用vb的开发者,就没有必要换用其它的语言,但是用c++ 的开发者会高兴得不得了。我们将在后面看到关于c#的例子
jscript
如我所知,这也是以前老版本的jscript。如同vb一样,jscript也从ngws runtime中得益不少,并且它也是被编译过
的。
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器