我与编写JavaScript代码倒计时:错误连接到SQL,asp.net C#
<script language="JavaScript">
TargetDate = "<% = TargetDate %>";
/*this is a property in code behind*/BackColor = "palegreen";
ForeColor = "navy";
CountActive = true;
CountStepper = -1;
LeadingZero = true;
DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
FinishMessage = "the auction end"
</script>
<script language="JavaScript" src="countdown.js"></script>
</script>
后面的代码:
public string TargetDate()
{
DataTable dataTable = new DataTable();
using (SqlConnection connection = new SqlConnection("Server=localhost;Database=Timer;Trusted_Connectopn=True"))
using (SqlCommand command = connection.CreateCommand())
{
command.CommandText = "select * from endTime";
connection.Open();
SqlDataReader reader = command.ExecuteReader();
dataTable.Load(reader); }
}
我得到的错误: “T .TargetDate()':不是所有的代码路径都返回值。
当我试着写了回报,我得到了另一个错误...什么意思,我不知道该怎么做:)
您是否找到此解决方案? – 2011-05-25 18:56:22