|
|
|
ช่วยดูโค๊ดให้หน่อยค่ะ Error Incorrect syntax near '.' |
|
|
|
|
|
|
|
Code (C#)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using System.Data.SqlClient;
using System.Data;
using System.Net.Mail;
using System.Web.Security;
using System.Text.RegularExpressions;
using System.Drawing;
public partial class contractExpire : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Binddata();
}
}
private DataTable Getcontact()
{
using (SqlConnection cn = new SqlConnection(Globals.Con))
{
string sql = " SELECT tbx_TranContact.TranID,tbx_TranContact.PropViewer,tbx_TranContact.DateIssue,tbx_TranContact.DateAppr,tbx_TranContact.ContactTitle ";
sql = sql + " tbx_Validity.ValidTime";
sql = sql + " FROM tbx_TranContact INNER JOIN ";
sql = sql + " tbx_Validity ON tbx_TranContact.ValidID = tbx_Validity.ValidID ";
sql = sql + "WHERE (tbx_TranContact.TranType ='E')AND (tbx_Validity.ExpireDate) < " + DateTime.Now.ToString() + ")";
SqlCommand cmd = new SqlCommand(sql, cn);
cmd.CommandType = CommandType.Text;
cn.Open();
DataTable dt = new DataTable();
System.Data.Common.DbDataReader dr;
dr = cmd.ExecuteReader();
dt.Load(dr);
return dt;
}
}
private void Binddata()
{
DataTable dt = new DataTable();
dt = Getcontact();
grdSearch.DataSource = dt;
grdSearch.DataBind();
}
protected void grdSearch_RowCreated(object sender, GridViewRowEventArgs e)
{
}
protected void grdSearch_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
}
protected void grdSearch_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("OnMouseOver", "style.backgroundColor='#F9E9F2'");
e.Row.Attributes.Add("OnMouseOut", "style.backgroundColor='#FFFFFF'");
}
}
protected void grdSearch_RowCommand(object sender, GridViewCommandEventArgs e)
{
}
protected void grdSearch_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
grdSearch.PageIndex = e.NewPageIndex;
Binddata();
}
}
Tag : ASP, Ms SQL Server 2008, C#, Web Service
|
|
|
|
|
|
Date :
2013-03-12 16:40:38 |
By :
หมูแดง |
View :
1215 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่รู้ว่าผิดตรงไหน แก้ไม่ถูกเลยรบกวนช่วยแนะนำหน่อยนะคะ
|
|
|
|
|
Date :
2013-03-12 17:14:46 |
By :
หมูแดง |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|