我需要通过脚本任务连接到SQL Server数据库,以便使用ADO.Net提供程序/连接填充DataTable
,我。但是对于我的生活,我会遇到各种各样的错误。例如,使用SqlAdapter
时出现无效对象错误,但SqlCommand
在SSMS中执行时没有错误:
SqlConnection conn;
ConnectionManager cm;
SqlCommand cmd;
cm = Dts.Connections["AdoNet"];
conn = (SqlConnection)cm.AcquireConnection(Dts.Transaction);
using (conn)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = queryString;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.Fill(myDataTable);
}
答案 0 :(得分:3)
请尝试以下代码:
<script type="text/javascript">
$(document).ready(function () {
var url = window.location.href;
if(url.includes('franky')) //includes() method determines whether a string contains specified string.
{
alert("url contains franky");
}
});
</script>