我與編寫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