我有这样的课;
public class MyStok
{
public int STId { get; set; }
public int SM { get; set; }
public string CA { get; set; }
public string Br { get; set; }
public string BNo { get; set; }
public decimal Vat { get; set; }
public decimal Price { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我像这样deserilala;
string sc= e.ExtraParams["sc"].ToString();
MyStok myobj = JSON.Deserialize<MyStok>(sc);
Run Code Online (Sandbox Code Playgroud)
我的输出似乎喜欢这个(字符串sc)在fiddler上
[
{
"STId": 2,
"CA": "hbh",
"Br": "jhnj",
"SM": 20,
"Vat": 10,
"Price": 566,
"BNo": "1545545" …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用server_broker功能从sqlserver获取更改的值.
我的代码如下
protected void Page_Load(object sender, EventArgs e)
{
GetData2();
}
private void GetData2()
{
List<Masa> lst = new List<Masa>();
using (SqlConnection con = Baglan.Sql)
{
string sql = "SELECT [Id],[Ad],[Durum] FROM [dbo].[Masa]";
using (SqlCommand cmd = new SqlCommand(sql, con))
{
con.Open();
SqlDependency dependency = new SqlDependency(cmd);
dependency.OnChange += new OnChangeEventHandler(dependency_OnDataChangedDelegate);
using (IDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection))
{
while (reader.Read())
{
Masa alt = new Masa
{
Ad = reader["Ad"].ToString(),
Id = reader["Id"].ToString(),
Durum = reader["Durum"].ToString()
};
lst.Add(alt);
}
gridMasa.GetStore().DataSource = …Run Code Online (Sandbox Code Playgroud) 我在这里有代码示例,我可以直接保存为PDF文件,但我想要做的是显示客户端的第一个pdf文件,并允许用户保存它.我该如何实现这一目标?
ReportDocument rpt = new ReportDocument();
rpt.Load(@"C:\CrystalReport2.rpt");
rpt.SetDataSource(datatablesource);
ExportOptions rptExportOption;
DiskFileDestinationOptions rptFileDestOption = new DiskFileDestinationOptions();
PdfRtfWordFormatOptions rptFormatOption = new PdfRtfWordFormatOptions();
string reportFileName = @"C:\SampleReport.pdf";
rptFileDestOption.DiskFileName = reportFileName;
rptExportOption = rpt.ExportOptions;
{
rptExportOption.ExportDestinationType = ExportDestinationType.DiskFile;
//if we want to generate the report as PDF, change the ExportFormatType as "ExportFormatType.PortableDocFormat"
//if we want to generate the report as Excel, change the ExportFormatType as "ExportFormatType.Excel"
rptExportOption.ExportFormatType = ExportFormatType.PortableDocFormat;
rptExportOption.ExportDestinationOptions = rptFileDestOption;
rptExportOption.ExportFormatOptions = rptFormatOption;
}
rpt.Export();
Run Code Online (Sandbox Code Playgroud) 这是我的简单场景.我在ready()函数内部定义了一个变量,用于指定第一个值.
我也有外面的功能ready().我想要做的是在我的新函数中使用更改的变量.
这是我的JavaScript代码:
var myFunction = function() {
// I wanna change Vp value here and wanna
// use this function with the new value
Vp = "new value";
myFunction2 ();
};
$(document).ready(function () {
var Vp = "first value asign";
$('#btnAddCustomer').click(myFunction);
var myFunction2 = function() {
// I will use Vp variable here with new value
};
});
Run Code Online (Sandbox Code Playgroud) 我有一个简单的应用程序,它实现了Activity.
我正在实施list-view onItemClickListener如下.但是,我需要在这个函数中创建一个Intent.
我怎样才能做到这一点?
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView <? > arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
Toast.makeText(getBaseContext(), "Click", Toast.LENGTH_LONG).show();
//need to create intent here to load view
Intent myintent = new Intent(this, MYclass.class);
// but this gives me error
myintent.putExtra("id", "test");
startActivity(myintent);
}
});
Run Code Online (Sandbox Code Playgroud) 我有一些问题用这个表和代码创建查询,我知道"GROUP BY Branch.BranchName"导致获得多个记录,但是,如何避免这种情况并在单个查询中执行此操作.我想要得到的是一个包含BranchName的表 - total paidedvalue-- total notpayedvalue
SELECT
(
SELECT SUM (DeptDesciption.DeptValue)
FROM dbo.SudentPayments
INNER JOIN dbo.Student ON dbo.SudentPayments.StudentId = dbo.Student.StudentId
INNER JOIN dbo.DeptDesciption ON SudentPayments.DeptDesciptionId = DeptDesciption.DeptDesciptionId
INNER JOIN dbo.Branch on dbo.Branch.BranchId = Student.BranchId
WHERE SudentPayments.IsDeptPayed = 0
GROUP BY Branch.BranchName
) AS Payed,
(
SELECT SUM (DeptDesciption.DeptValue)
FROM dbo.SudentPayments
INNER JOIN dbo.Student ON dbo.SudentPayments.StudentId = dbo.Student.StudentId
INNER JOIN dbo.DeptDesciption ON SudentPayments.DeptDesciptionId = DeptDesciption.DeptDesciptionId
INNER JOIN dbo.Branch on dbo.Branch.BranchId = Student.StudentId
WHERE SudentPayments.IsDeptPayed = 1
GROUP BY Branch.BranchName …Run Code Online (Sandbox Code Playgroud) 我正在尝试添加分页存储过程的排序功能。
我该怎么做,到目前为止,我已经创建了这个。它可以正常工作,但是在传递@sort参数时不起作用。
ALTER PROCEDURE [dbo].[sp_Mk]
@page INT,
@size INT,
@sort nvarchar(50) ,
@totalrow INT OUTPUT
AS
BEGIN
DECLARE @offset INT
DECLARE @newsize INT
IF(@page=0)
begin
SET @offset = @page;
SET @newsize = @size
end
ELSE
begin
SET @offset = @page+1;
SET @newsize = @size-1
end
-- SET NOCOUNT ON added to prevent extra result sets from
SET NOCOUNT ON;
WITH OrderedSet AS
(
SELECT *,
ROW_NUMBER() OVER (ORDER BY @sort DESC) AS 'Index'
FROM [dbo].[Mk]
)
SELECT * …Run Code Online (Sandbox Code Playgroud) 我想这是一个简单的问题,但我需要帮助.
declare @Date date
SET @Date =GETDATE()
print @date
Run Code Online (Sandbox Code Playgroud)
宣言给了我结果: 2013-08-04
但我还需要几毫秒和几分钟.
我怎么能做到这一点?
如何将参数传递给sql server中的视图.我有一个stok包含stok信息,包括数量.我有一个表单,通过这个表单我添加了quatitiy到stok.我需要的是获取quatitiy的表单值并添加可用值的stok数量.为此我需要将pass参数传递给视图,该参数会自动将此值添加到stok中的当前值,谢谢大家的帮助
sql-server ×5
sql ×4
asp.net ×3
c# ×3
t-sql ×2
android ×1
ext.net ×1
javascript ×1
jquery ×1
json ×1