我想用一個存儲過程來獲取數據到一個文本框獲得使用存儲過程中的數據爲文本框:在LINQ
var q = objcontext.sploadloandata(comboBox1.Text);
txtcustname.Text = "what to do here";
txtaddress.Text = "what to do here";
txtmobile.Text = "what to do here";
txtemailid.Text = "what to do here";
此代碼是我的存儲過程,請給我拿出這個問題
alter proc sploadloandata
@customerid nvarchar(50)
as
begin
declare @today datetime
SET @today = dateadd(day, datediff(day, 0, current_timestamp), 0)
select
a.custid, b.name, b.mobile, b.phone, a.eligibleamt,
a.loanamt, a.interest, a.validity,
datediff(day, a.cdate, @today) as No_Of_Days,
round(a.loanamt * a.interest * datediff(day, a.cdate, @today)/36500, 2) as SI,
round(a.loanamt * a.interest * datediff(day, a.cdate, @today)/36500, 2) + a.loanamt as CHECKsi
from
tblLoanEntrydetails a, tbl_customer b
where
a.custid = b.cid
and b.cid = @customerid
order by
a.fororderdate desc
end
這個問題需要更多的有點像,你想幹什麼?你是否試圖將q的屬性放入不同的文本框? –
您已經成功演示瞭如何使用var來導致混淆代碼。 –
@VarmaAmit除了發佈代碼之外,你在結尾做了些什麼,這些代碼實際上並不涉及任何接近你想要實現的內容?你是否執行過谷歌搜索......如果你不熟悉如何從後面的C#代碼調用存儲過程,那麼你怎麼能期望你理解比使用'Linq'更復雜的東西,在線有成千上萬的例子關於如何使用C#從數據庫返回數據,以及如何使用DataAdapter等遍歷結果集。 – MethodMan