我需要阅读所有的Child Nodes我的<Imovel>标签,问题是,我有超过1(一)<Imovel>在我的XML文件中的标记,每个之间的区别<Imovel>标签是所谓的ID属性.
这是一个例子
<Imoveis>
<Imovel id="555">
<DateImovel>2012-01-01 00:00:00.000</DateImovel>
<Pictures>
<Picture>
<Path>hhhhh</Path>
</Picture>
</Pictures>
// Here comes a lot of another tags
</Imovel>
<Imovel id="777">
<DateImovel>2012-01-01 00:00:00.000</DateImovel>
<Pictures>
<Picture>
<Path>tttt</Path>
</Picture>
</Pictures>
// Here comes a lot of another tags
</Imovel>
</Imoveis>
Run Code Online (Sandbox Code Playgroud)
我需要阅读每个标签的所有<Imovel>标签,并且在我在<Imovel>标签中进行的每次验证结束时,我需要进行另一次验证.
所以,我认为我需要做2(2)foreach或a for和a foreach,我不太了解LINQ但是按照我的样本
XmlReader rdr = XmlReader.Create(file);
XDocument doc2 = XDocument.Load(rdr);
ValidaCampos valida = new ValidaCampos();
//// Here I Count …Run Code Online (Sandbox Code Playgroud) 如何在查询中插入单引号?
例
select *, 'INSERT INTO San_Endereco (Endereco_Id, Logradouro_Id, Bairro_Id, CEP, Logradouro, Livre) VALUES
(' + CAST(Endereco_Id as varchar) + ','
+ CAST(Logradouro_Id as varchar) + ','
+ CAST(Bairro_Id as varchar) + ','
+ CAST (CEP as varchar) + ','
+ CAST(Logradouro as varchar) + ','
+ CAST(Livre as varchar) + ')' as teste
FROM San_Endereco
Run Code Online (Sandbox Code Playgroud)
在每个CAST我需要之前把单引号.我怎样才能做到这一点 ?
我试图<!CDATA>在我的XML文件中放入一个特定的标签,但结果是<![CDATA[mystring]]>
有人可以帮帮我吗?
编码
XmlProcessingInstruction pi = doc.CreateProcessingInstruction("xml", "version=\"1.0\" encoding=\"utf-8\"");
Run Code Online (Sandbox Code Playgroud)
我是怎么做的
texto.InnerText = "<![CDATA[" + elemento.TextoComplementar.ToString() + "]]>";
Run Code Online (Sandbox Code Playgroud) 我想从GridView中的TextBox获取Text属性.此TextBox包含来自我的数据库的一些数据.当我更改此数据时,我想在我的数据库中进行更新.
但是当我搜索TextBox的Text时,他得到了来自我的数据库的旧值,而不是我现在放的值.
如何获取我在TextBox中编写的实际数据,而不是来自我的数据库?
protected void VerifyPriority()
{
for (int i = 0; i < GridView1.Rows.Count; i++)
{
GridViewRow RowView = (GridViewRow)GridView1.Rows[i];
TextBox txt = (TextBox)GridView1.Rows[i].FindControl("txtPriority");
if (txt != null)
{
if (txt.Text != this.changes[i])
{
this.UpdatePriority(this.codigo[i], txt.Text);
}
}
}
}
Run Code Online (Sandbox Code Playgroud) 我怎么能在另一个CTE上打电话给CTE?
WITH cte1
AS (
SELECT City.*
FROM City
WHERE (City.CityName COLLATE SQL_Latin1_General_CP1_CI_AI) LIKE 'são paulo'
)
, cte2
AS (
SELECT Imovel.Imovel_Id
FROM Imovel
WHERE Imovel.Number = 311
AND Imovel.ZIPCode = '30280490'
AND Imovel.Complement = ''
AND Imovel.Street = 'Do furquim'
-- the line below has an error in cte.City_Id
AND Imovel.City_Id = cte1.City_Id
)
Run Code Online (Sandbox Code Playgroud) 当此复选框位于gridview内时,如何选中复选框时如何调用Javascript函数?
protected void AlteraStatusExpiraSeteDias_Click(object sender, EventArgs e)
{
for (int i = 0; i < grdImoveis2.Rows.Count; i++)
{
GridViewRow RowViewExpiraSeteDias = (GridViewRow)grdImoveis2.Rows[i];
CheckBox chk = (CheckBox)grdImoveis2.Rows[i].FindControl("chkExpiraSeteDias");
if (chk != null)
{
String codigo;
if (chk.Checked)
{
codigo = (String)grdImoveis2.Rows[i].Cells[0].Text;
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Registra", "AlteraStatus(codigo);", false);
}
}
}
}
<asp:GridView ID="grdImoveis2" CssClass="StyleGrid" Width="100%" runat="server" AutoGenerateColumns="false" DataSourceID="ds" BorderWidth="0" GridLines="None">
<AlternatingRowStyle BackColor="White" CssClass="EstiloDalinhaAlternativaGrid" HorizontalAlign="Center"/>
<RowStyle CssClass="EstiloDalinhaGrid" HorizontalAlign="Center" />
<HeaderStyle BackColor="#e2dcd2" CssClass="thGrid" Height="20" />
<Columns>
<asp:BoundField HeaderText="Código" DataField="Imovel_Id" />
<asp:BoundField HeaderText="Para" DataField="TransacaoSigla" />
<asp:BoundField …Run Code Online (Sandbox Code Playgroud) 我的查询中有一个datetime列,我想在此查询中执行CASE.
如果DateDelivered列不为null,则显示日期,否则,显示字符串'Pendent'我该怎么做?
CASE WHEN DateDelivered IS NOT NULL THEN DateDelivered ELSE 'Pendent' END AS DateDelivered 2
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误
Conversion failed when converting date and/or time from character string.
Run Code Online (Sandbox Code Playgroud)
整个查询
SELECT San_Imovel.Imovel_Id ,
San_Chave.DataHoraPegou ,
CASE WHEN San_Chave.DateDelivered IS NOT NULL THEN San_Chave.DateDelivered
ELSE ISNULL(CAST(San_Chave.DateDelivered AS VARCHAR), 'Pendent')
END AS DateDelivered2 ,
San_Usuario.NomeCompleto + ' - ' + sc.Apelido AS Nome ,
San_Cliente.NomeCompleto AS NomeCliente ,
San_Credenciada.Apelido ,
San_Cliente.Cliente_Id ,
San_ChaveImovel.QuantidadeChave
FROM San_ChaveImovel
JOIN San_Chave ON San_ChaveImovel.Chave_Id = San_Chave.Chave_Id
JOIN San_Credenciada ON …Run Code Online (Sandbox Code Playgroud) 我有以下代码,但我遇到了问题.在我的While中,必须测试r ["Varandas"]是否为空.在一个特定的imovel_id中,r ["Varandas"]为空,但仍然通过我的代码,然后我得到一个异常错误,因为无法解析为r ["Varandas"]因为为null,但为什么他通过通过我的While循环中的第一个IF?
string s = "SELECT * "
+ "FROM San_Imovel_Caracteristica "
+ "WHERE Imovel_Id = " + imovel_id + " ";
SqlConnection c = new SqlConnection(conn.Con);
SqlCommand cmd = new SqlCommand(s, c);
c.Open();
SqlDataReader r = cmd.ExecuteReader();
while (r.Read())
{
if (r["Varandas"] != null)
{
if (Convert.ToInt32(r["Varandas"].ToString()) > 0)
{
XmlElement itemImovel1 = doc.CreateElement("itemImovel");
caracteristicasImovel.AppendChild(itemImovel1);
itemImovel1.InnerText = "varanda";
}
}
}
Run Code Online (Sandbox Code Playgroud) 关闭页面后,我将运行以下javascript代码。
$(window).unload(function () {
window.opener.location.reload();
});
Run Code Online (Sandbox Code Playgroud)
有没有一种方法可以将参数传递给调用此关闭页面的页面?
如何进行多重拆分?
例
string eq = SIN(X)/3
我可以像这样分裂,string equation[] = eq.Split['/']但如果我+, -, *, /在我的等式中我怎么能分裂这个?
例
string eq = SIN(X) + 3 / 3 * 4