我正在.Net和SQL服务器上进行多级营销领域的项目.在数据库中,它应该像二叉树一样保存.我该如何设计数据库?
我试图在LINQ中使用表达式树创建一个动态查询来表示以下查询
WageConstIns.Where(WageConstIn => WageConstIn.Serialno.ToString().StartsWith("2800"));
Run Code Online (Sandbox Code Playgroud)
我试图像这样创建它:
MemberExpression le1 = LinqExpression.Property(paramExp, "Serialno");
MethodCallExpression le2 = LinqExpression.Call(le1, typeof(string).GetMethod("ToString", System.Type.EmptyTypes));
ConstantExpression le3 = LinqExpression.Constant("2800");
MethodCallExpression le4 = LinqExpression.Call(le2, typeof(string).GetMethod("StartsWith"));
Run Code Online (Sandbox Code Playgroud)
我在运行时遇到错误.如何使用表达式树最好地构建上述查询?
我有一个如下所示的SQL查询我想使用变量streetname,keyword1,radius并使用like关键字执行sql查询但是它们是查询语法的一些问题可以任何人帮助
protected void CreateXML(string keyword1, string streetname, string lat, string lng, string radius)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "data source='192.168.0.221';user id='sa';password='$sql123';persist security info=False;initial catalog=Test;Connect Timeout=100; Min Pool Size=100; Max Pool Size=500";
con.Open();
DataSet ds = new DataSet();
SqlCommand com = new SqlCommand();
SqlDataAdapter sqlda = new SqlDataAdapter(com);
sqlda.SelectCommand.CommandText = "SELECT Id,Name1,ZipCode,StreetName,StreetNumber,State1,Lat,Lng, ( 6371 * ACOS( COS( (12.925432/57.2958) ) * COS( (Lat/57.2958) ) * COS( ( Lng/57.2958 ) - (77.591667/57.2958) ) + SIN( 12.925432/57.2958 ) * SIN( Lat/57.2958 …
Run Code Online (Sandbox Code Playgroud) 我有一个问题:
Select a.Col1,b.Col2
From a
Left Join B b ON a.C = b.C
Where b.D ='someValue'
Run Code Online (Sandbox Code Playgroud)
但是当右侧为空时,我没有记录,所以左连接不起作用.
您知道如何更改此查询以更正查询吗?
得到这个xml:
<?xml version="1.0" encoding="UTF-8"?>
<video xmlns="UploadXSD">
<title>
A vid with Pete
</title>
<description>
Petes vid
</description>
<contributor>
Pete
</contributor>
<subject>
Cat 2
</subject>
</video>
Run Code Online (Sandbox Code Playgroud)
而这个xpath:
videoToAdd.Title = doc.SelectSingleNode(@"/video/title").InnerXml;
Run Code Online (Sandbox Code Playgroud)
我得到一个'对象引用未设置为对象的实例'.任何想法为什么这是一个有效的xpath我可以看到它曾经工作...