|
.net 求救 (Server.MapPath)
[复制链接]
|
|
发表于 15-2-2007 10:44 PM
|
显示全部楼层
暂时还不清楚你的 code 有什么问题... 但有没有 trace 看 code 里面的 value? 或你先选择 Loc 1 和 loc 3 看看行不行? |
|
|
|
|
|
|
|

楼主 |
发表于 23-2-2007 10:28 AM
|
显示全部楼层
单选的话,Loc 1 和Loc 3还是不能出来,Loc 2 和Grand Total就没问题。我想不出这两个column到底有什么问题。
我尝试把这两个column在excel里换去“text”先,就没问题了。虽然是没问题了,可是还是觉得很不逻辑,为什么Loc 2 和 Grand Total 是number,可以display到,Loc 1 和 Loc 3 也是number却不可以。。 |
|
|
|
|
|
|
|
发表于 26-2-2007 09:38 AM
|
显示全部楼层
回复 #102 shinelynn 的帖子
回答不上来... 只能归于是 Excel 的 bug...  |
|
|
|
|
|
|
|

楼主 |
发表于 17-8-2007 03:11 PM
|
显示全部楼层
简单的asp.net,onclick button时,button的text应该换去"You clicked me!",可是为什么按了button,它的text没换到的。。
<script runat="server">
Sub submit(ByVal Source As Object, ByVal e As EventArgs)
button1.Text = "You clicked me!"
End Sub
</script>
<html>
<body>
<form runat="server">
<asp:Button ID="button1" Text="Click me!" runat="server" OnClick="submit"
/>
</form>
</body>
</html> |
|
|
|
|
|
|
|
发表于 20-8-2007 02:35 PM
|
显示全部楼层
按下去的时候, 发生了什么事? 有没有 error? 有没有完整的 code? |
|
|
|
|
|
|
|

楼主 |
发表于 20-8-2007 03:16 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 21-8-2007 01:12 AM
|
显示全部楼层
回复 #106 shinelynn 的帖子
test 了,没问题呀。。。 |
|
|
|
|
|
|
|

楼主 |
发表于 21-8-2007 09:25 AM
|
显示全部楼层
回复 #107 SKYLINE84 的帖子
妈啊有鬼,我今天又试,却可以了!
谢谢。 |
|
|
|
|
|
|
|
发表于 21-8-2007 09:29 AM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 27-8-2007 11:40 AM
|
显示全部楼层
我不明白namespace是要做莫的,我用vs.net 2003 create的project,全部item (asp.net,class)都会under同一个namespace (namespace assinged automatically to every item following the project name)。
我现在用vs2005,这些item都没有under一个namespace的,而且我create的class是被放进App_Code的folder里面,我用一个asp.net的page call class里面的function都call不到的。。之前用vs.net 2003有namespace就没问题。我现在想要把namespace manually加进每一个item,加了又有error的。。。。。。做莫会酱。。。
DataServer.cs,放在App_Code里,
public class DataServer
{
private OleDbConnection ReqDBConn;
private OleDbCommand ReqDBCmd;
private OleDbDataAdapter ReqDBAdapter;
private DataTable ReqDBTable;
private string ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;data
source = db_test.mdb";
public string fLogIn(string strUsrID, string strUsrPwd)
{
.....
}
public string cstr(string strText)
{
.....
}
}
其中一个asp.net在button on click时,
DataServer ds = new DataServer();
strLogIn = ds.fLogIn(txtUsrName.Text, txtPwd.Text);
IE有error说,
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'DataServer'
could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 31: string strLogIn;
Line 32:
Line 33: DataServer ds = new DataServer();
Line 34: strLogIn = ds.fLogIn(txtUsrName.Text, txtPwd.Text);
救命啊。。。。。 |
|
|
|
|
|
|
|
发表于 28-8-2007 12:46 AM
|
显示全部楼层
看来看去都看不出你code有什么问题?把整段放上来如何? |
|
|
|
|
|
|
|
发表于 28-8-2007 10:01 AM
|
显示全部楼层
你的 DataServer 是不是在一个独立的 DLL? |
|
|
|
|
|
|
|

楼主 |
发表于 29-8-2007 12:47 PM
|
显示全部楼层
Data Server
using System;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
/// <summary>
/// Summary description for DataServer
/// </summary>
///
public class DataServer
{
private OleDbConnection ReqDBConn;
private OleDbCommand ReqDBCmd;
private OleDbDataAdapter ReqDBAdapter;
private DataTable ReqDBTable;
private string ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;data source = dbSalon.mdb";
public string fLogIn(string strUsrID, string strUsrPwd)
{
try
{
//Create New ConnectSion
ReqDBConn = new OleDbConnection(ConnStr);
//Create new data table to hold data
ReqDBTable = new DataTable();
//Create new data adapter
ReqDBAdapter = new OleDbDataAdapter();
//Connect select command to database
ReqDBCmd = ReqDBConn.CreateCommand();
ReqDBCmd.CommandText = "SELECT * FROM TBL_USR WHERE USRNAME = '" + strUsrID + "'";
ReqDBAdapter.SelectCommand = ReqDBCmd;
ReqDBAdapter.Fill(ReqDBTable);
string strPwd;
strPwd = "Fail";
foreach (DataRow ReqDBRow in ReqDBTable.Rows)
{
strPwd = ReqDBRow["USRPWD"].ToString();
if (strUsrPwd == strPwd)
{
strPwd = "Success";
}
else
{
strPwd = "Fail";
}
}
return strPwd;
}
catch (Exception e)
{
return (Convert.ToString(e));
}
}
}
slogin.aspx.cs
public partial class slogin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnEnter_Click(object sender, EventArgs e)
{
if (txtUsrName.Text == "")
{
lblMsg.Text = "Please enter username";
}
else if (txtPwd.Text == "")
{
lblMsg.Text = "Please enter password";
}
else
{
string strLogIn;
DataServer ds = new DataServer();
strLogIn = ds.fLogIn(txtUsrName.Text, txtPwd.Text);
if (strLogIn == "Success")
{
}
else
{
lblMsg.Text = "Invalid Password!";
}
}
}
}
DLL是c# class的意思吗? 我想把DataServer.cs放进和project同一个folder (和其他的aspx在一起),可是有warning message叫我放进project里头的一个叫App_Code的folder。
可以问下为什么project没有namespace的? |
|
|
|
|
|
|
|
发表于 29-8-2007 06:42 PM
|
显示全部楼层
原帖由 shinelynn 于 29-8-2007 12:47 PM 发表 
Data Server
slogin.aspx.cs
DLL是c# class的意思吗? 我想把DataServer.cs放进和project同一个folder (和其他的aspx在一起),可是有warning message叫我放进project里头的一个叫App_Code的folder ...
俺机子上试了没问题
自制.cs class 必须放在App_Code里头,这是规矩,放在其他地方它会找不到说。web page不需要namespace |
|
|
|
|
|
|
|

楼主 |
发表于 29-8-2007 07:03 PM
|
显示全部楼层
回复 #114 神仙祖宗 的帖子
啊,天啊! 可是我的做莫不行? |
|
|
|
|
|
|
|
发表于 29-8-2007 08:16 PM
|
显示全部楼层
是不是你其他dll (bin folder) 里面也有DataServer这个Class?
试试换个名字? |
|
|
|
|
|
|
|
发表于 30-8-2007 08:15 AM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 30-8-2007 10:01 AM
|
显示全部楼层
回复 #116 神仙祖宗 的帖子
没有,只有一个。我其实有一个问题,可是不知道有没有关系。在Tools ->Options那里的setting,under Projects and Solutions,有Visual Studio projects location, Visual Studio user project templates location和Visual Studio user item templates location,我全部把它们还去C:\Inetpub\wwwroot了,本来的path是Visual Studio 2005里头了。
我换了path之后,每当我create一个project时,它会auto create另一个同样的folder给我,比如说,
我create了,"TestSys",就有一个folder created under C:\Inetpub\wwwroot,可是,不知怎么的,它auto create了"TestSys(2)",然后把TestSys.sln solution放进这folder里头,是不是因为这样我compile不到?
回复 #117 johe07 的帖子
我组屋这里有放白布电影,一晚放两套戏,我昨晚还开tv2的LOTR和外头的倩女幽魂斗大声。可能就因为这样。。。。。。 |
|
|
|
|
|
|
|
发表于 30-8-2007 08:39 PM
|
显示全部楼层
回复 #118 shinelynn 的帖子
虽然没试过,不过照理说换那些path不会造成compile error。一定有其它原因,换了名字(DataServer)也一样么? |
|
|
|
|
|
|
|

楼主 |
发表于 3-9-2007 08:02 AM
|
显示全部楼层
原帖由 神仙祖宗 于 30-8-2007 08:39 PM 发表 
虽然没试过,不过照理说换那些path不会造成compile error。一定有其它原因,换了名字(DataServer)也一样么?
解决了谢谢,我去IIS那里把这project加进了Virtual Directory,原来要manually加的才行啊? |
|
|
|
|
|
|
| |
本周最热论坛帖子
|