Monday, December 23, 2013
Cs file to help you see what's wrong with this bar
This is the cs code
using System;
using System.Collections;
using System.Configuration;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data;
using System.Data.SqlClient;
using System.Web.Security;
using System.Xml.Linq;
public partial class zizhutingcheaspx: System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
}
protected void Button1_Click (object sender, EventArgs e)
{
string strConn;
SqlDataAdapter objDataAdapter;
strConn = "server = localhost; database = intelliCampus; uid = sa; pwd = 123"; / / case insensitive, ok / / value is true (with sspi), OK
SqlConnection myConn = new SqlConnection (strConn);
myConn.Open ();
SqlCommand cmd = new SqlCommand ("select * from tb_sensor_parkingPlace", myConn);
objDataAdapter = new System.Data.SqlClient.SqlDataAdapter ("SELECT [status] FROM [tb_sensor_parkingPlace]", myConn);
DataTable dt = new DataTable ();
objDataAdapter.Fill (dt);
int [] a = new int [27];
for (int i = 0; i <= 27; i + +) / / This is sometimes prompted bounds error
{
a [i] = int.Parse (dt.Rows [i]. ToString ()) ;/ / This suggests formatexeceptionhe
Remove the error function is assigned to a column of an array } from a table in the database
for (int j = 0; j <27; j + +)
{
int n = j + 13;
if (a [j] == 0)
{
FindControl ("apDiv" + n.ToString ()). Visible = false ;/ / hide
}
else
{
FindControl ("apDiv" + n.ToString ()). Visible = true ;/ / display
}
}
myConn.Close () ;/ / close the connection database
myConn = null;
}
}
Reply:
The wrong zone.
Reply:
for (int i = 0; i <= 27; i + +) / / This is sometimes prompted bounds error you feel this one is not due to the change for (int i = 0; i <27; i + +) Yeah your landlord Try
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment