TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
MANEESH AN
NA
110
47k
SELECT ON GRID
Aug 3 2013 3:43 AM
ERROR FOUND" Column 'SerialNo' does not belong to table Table. AND IN CORRECT SYNATXX NEAR ';'
SP
ALTER PROCEDURE [dbo].[prctblSalesInvoiceView]
(
@WhereCondition nvarchar(4000)
)
as
--prctblPurchaseInvoiceView ''
declare @SQLQuery nvarchar(4000);
BEGIN
set @SQLQuery='
select
iSerialNo
,iSalesID
,iAccID
,vAccName as ''CustomerName''
,vBillNo as ''BillNo''
,convert(varchar,dInvoiceDate,106) as ''InvoiceDate''
,vOldNew as OldNew
,deTotAmount as TotalAmount
,deRecAmount as RecAmount
,deBalAmount as BalAmount
,deMakChargesTotal as MakChargesTotal
from tblSales
'
+@WhereCondition
exec sp_executesql @SQLQuery
END
private void fnInvoiceDetailsrView(string searchvalue)
{
try
{
DataSet ds = new DataSet();
ds.Tables.Clear();
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = new SqlCommand("prctblSalesInvoiceView", ClsConnect.conSql);
sda.SelectCommand.CommandType = CommandType.StoredProcedure;
sda.SelectCommand.Parameters.AddWithValue("@WhereCondition", searchvalue);
string s = ClsConnect.conSql.State.ToString();
if (s == "Open")
{
ClsConnect.conSql.Close();
}
ClsConnect.conSql.Open();
sda.Fill(ds);
ClsConnect.conSql.Close();
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
ds.Tables[0].Rows[i]["SerialNo"] = i + 1;
}
dgvBillSearch.DataSource = ds.Tables[0];
dgvBillSearch.Columns[0].Width = 60;
dgvBillSearch.Columns[1].Visible = false;
dgvBillSearch.Columns[2].Visible = false;
dgvBillSearch.Columns[3].Width = 114;
dgvBillSearch.Columns[4].Width = 75;
dgvBillSearch.Columns[5].Width = 75;
dgvBillSearch.Columns[6].Width = 75;
dgvBillSearch.Columns[7].Width = 75;
dgvBillSearch.Columns[8].Width = 75;
dgvBillSearch.Columns[9].Width = 75;
}
}
catch (Exception ex)
{
fnInvoiceDetailsrView("");
// MessageBox.Show(ex.Message);
}
txtCustCodeName.Focus();
}
Reply
Answers (
4
)
sql query using due date add the one year
How to set border width of combobox in c# windows Form Appli