In my database 1 is used to represent true and 0 to represent false. In my column, now i was wondering if anyone can help me write a query that outputs if the value equals to 1 display true if equals to 0 display false?.
我有一个返回信息的数据表方法,但我的参数有问题,它一直抛出一个必须声明变量'@SUPartnerNo'错误.我试图谷歌,但我找到的解决方案都没有帮助.我不想将我的参数直接嵌入到我的查询中,因为它不是很好的做法
public DataTable SearchInvoiceHeader(string SUPartnerNo, string invoiceNo, string bdate, string edate)
{
DataTable dt = new DataTable();
try
{
StringBuilder mySelectQuery = new StringBuilder(9000);
mySelectQuery.AppendLine(@"SELECT I.[InvoiceNo]
,I.[SUPartnerNo]
,I.[OrderNo]
,I.[RefNo]
,I.[DocType]
,I.[SAP_Type]
,I.[SUName]
,I.[InvoiceDate]
,I.[PaymentDate]
,I.[BaseLineDate]
,I.[DeliveryDate]
,I.[DeliveryNoteNo]
,I.[TotalAmount]
,I.[StartTime]
,p.ProcessType
,s.DocDate
,s.IDocNo
,s.TotalValue
FROM [dbo].[mainhead] I WITH (NOLOCK)
LEFT JOIN [INV_Processed] p WITH (NOLOCK)
ON p.InvoiceNo = I.InvoiceNo
AND p.PartnerNo = I.SUPartnerNo
LEFT JOIN dbo.INV_SAP s WITH (NOLOCK)
ON s.InvoiceNo = I.InvoiceNo
AND s.SupplierNo = I.SUPartnerNo
WHERE
(I.SUPartnerNo …Run Code Online (Sandbox Code Playgroud) 我正在通过linq搜索姓名和姓氏,我想将结果绑定到转发器.
我究竟做错了什么?
// this the results for list
public static List<SearchResults> lsSearchResults = new List<SearchResults>();
public class SearchResults
{
public string Name { get; set; }
public string Surname { get; set; }
public SearchResults(string name, string surname)
{
Name = name;
Surname = surname;
}
}
// search button
protected void btnSearch_Click(object sender, EventArgs e)
{
var found = (from User in myDB.Memberships
where User.Name.ToLower().Contains(txtSearch.Text.ToLower()) ||
User.Surname.ToLower().Contains(txtSearch.Text.ToLower())
select new { User.Name, User.Surname });
// validates items in search query …Run Code Online (Sandbox Code Playgroud)