(3)创建ASP程序
以下是ASP程序源代码,文件名为ConnectASP.asp,保存到D:\J2ME\J2METEST\IIS\ASP中。
? ? //ConnectASP.asp <%@LANGUAGE=VBScript%> <% strDBLocation=Server.Mappath("/database/j2meTest.mdb"); strConnectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source="+strDBLocation; var cnn=Server.CreateObject("ADODB.Connection"); cnn.Open(strConnectionString); rs=Server.CreateObject("ADODB.Recordset"); ip=Request.ServerVariables("REMOTE_ADDR"); message=Request.QueryString("message"); rs.ActiveConnection=cnn; rs.CursorType=1; rs.LockType=2; rs.Source="Message"; rs.Open(); rs.AddNew(); rs("Message")=message; rs("IP")=ip; rs("Date")=(new Date()).getVarDate(); rs.Update(); rs.Close(); cnn.Close(); Response.Write("The message writed successfully. "); %>
然后在浏览器中输入以下URL:http://localhost/asp/ConnectASP.asp?message=Hello+J2ME!
运行后 错误类型: Microsoft VBScript 编译器错误 (0x800A0401) 语句未结束 /ConnectASP.asp, line 5, column 54 strDBLocation=Server.Mappath("/DATEBASE/J2MEtest.mdb");请高人指教