Avatar of bside2011

asked on 

Timer countdown sql, asp.net c#

i have the next javascript code at my try.aspx file:
<input type="hidden" id="auctionEndDate" value="<%=TargetDate%>"> 
<script language="JavaScript"> 
    TargetDate = "document.forms[0].TargetDate.value"; 
    /*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 language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js"></script> 

Open in new window

code behind:
public string TargetDate () 
    String tDate = "";  
    DataTable dataTable = new DataTable();  
    using (SqlConnection connection = new SqlConnection("Server=localhost;Database=Timer;Trusted_Connection=True"))  
    using (SqlCommand command = connection.CreateCommand())    
        command.CommandText = "select * from endTime";      
        SqlDataReader reader = command.ExecuteReader();     
        tDate = dataTable.Rows[0][0].ToString(); // Expecting the first row and first column 
    return tDate; 

Open in new window

but i got that error:
CS1502: The best overloaded method match for 'System.IO.TextWriter.Write(char)' has some invalid arguments

for the line:
<input type="hidden" id="auctionEndDate" value="<%=TargetDate%>">

what i'm trying to do is to build timer countdown for item, and the endtime coming from sql database. maybe all the way is wrong, i'll be glad to get others way to do that, or fix the error's on the code that i post here.

Avatar of undefined
Last Comment

8/22/2022 - Mon