D
Decompressor
Guest
Hi, condition: sql database customs with table dbo.goods
create table dbo.goods (calendar datetime,good_type varchar(max),good_amount int)
insert dbo.goods
values ('2020-11-01T07:48:15.000', 'peach: invoice 715282; 15 pallets per 1832 boxes', null),
('2020-12-01T18:25:14.000', 'apple green, specification 2981, 185 boxes; apple red: bill 133454, 1334
pallets per 12453 boxes, 18 pallets - 134 boxes on pallet',null),
('2020-11-02T11:15:34.000', 'brush. invoice 13353; 153843 items', 153843)
I need to calculate good_amount, where it's null. Result will be: peach - 1832,
apple- 12772
Thank you
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Linq;
using System.Data.Linq.Mapping;
namespace LinqDataManipulationApp
{
public class Customs : DataContext
{
public Table<Good> goods;
public Customs(string connection) : base(connection) { }
}
[Table(Name = "Goods")]
public class Good
{
private DateTime _calendar;
[Column(Storage = "_calendar")]
public DateTime calendar
{
get
{
return this._calendar;
}
set
{
this._calendar = value;
}
}
private string _good_type;
[Column(Storage = "_good_type")]
public string good_type
{
get
{
return this._good_type;
}
set
{
this._good_type = value;
}
}
private int _good_amount;
[Column(Storage = "_good_amount")]
public int good_amount
{
get
{
return this._good_amount;
}
set
{
this._good_amount = value;
}
}
}
class Program
{
static void Main(string[] args)
{
Customs db = new Customs(@"c:\linqtest6\customs.mdf");
var goodQuery =
from i in db.goods
where i.good_type.Contains( "123456789")
select i;
foreach (Good i in goodQuery)
{
Console.WriteLine(i.calendar+" "+i.good_type+" " i.good_amount);
Console.ReadLine();
}
}
}
}
Continue reading...
create table dbo.goods (calendar datetime,good_type varchar(max),good_amount int)
insert dbo.goods
values ('2020-11-01T07:48:15.000', 'peach: invoice 715282; 15 pallets per 1832 boxes', null),
('2020-12-01T18:25:14.000', 'apple green, specification 2981, 185 boxes; apple red: bill 133454, 1334
pallets per 12453 boxes, 18 pallets - 134 boxes on pallet',null),
('2020-11-02T11:15:34.000', 'brush. invoice 13353; 153843 items', 153843)
I need to calculate good_amount, where it's null. Result will be: peach - 1832,
apple- 12772
Thank you
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Linq;
using System.Data.Linq.Mapping;
namespace LinqDataManipulationApp
{
public class Customs : DataContext
{
public Table<Good> goods;
public Customs(string connection) : base(connection) { }
}
[Table(Name = "Goods")]
public class Good
{
private DateTime _calendar;
[Column(Storage = "_calendar")]
public DateTime calendar
{
get
{
return this._calendar;
}
set
{
this._calendar = value;
}
}
private string _good_type;
[Column(Storage = "_good_type")]
public string good_type
{
get
{
return this._good_type;
}
set
{
this._good_type = value;
}
}
private int _good_amount;
[Column(Storage = "_good_amount")]
public int good_amount
{
get
{
return this._good_amount;
}
set
{
this._good_amount = value;
}
}
}
class Program
{
static void Main(string[] args)
{
Customs db = new Customs(@"c:\linqtest6\customs.mdf");
var goodQuery =
from i in db.goods
where i.good_type.Contains( "123456789")
select i;
foreach (Good i in goodQuery)
{
Console.WriteLine(i.calendar+" "+i.good_type+" " i.good_amount);
Console.ReadLine();
}
}
}
}
Continue reading...