我的模板
static void Upload()
{
int count = 0;
string connstring = "Data Source=(local);Initial Catalog=Images;Persist Security Info=True;User ID=test;Password=testpassword";
DataTable dtconnection = Query("Select ConnectionString from IT.Connection where isnull(ConnectionString,'')!=''", connstring);
foreach (DataRow dtcon in dtconnection.Rows)
{
DataTable convimage = Query("Select Keyfield,Path from dbo.ConvertedImage where isnull(Path,'')!='' and ISNULL(ConvertedImage,'')='' ", dtcon[0].ToString());
foreach (DataRow dtrow in convimage.Rows)
{
count++;
Console.WriteLine("Converting: " + dtrow[0].ToString() + " , " + count.ToString() + " of " + convimage.Rows.Count);
Image img = Image.FromFile(@dtrow[1].ToString());
ImageFormat thisFormat = img.RawFormat;
string message = string.Format("Converting {0} ", @dtrow[1].ToString());
byte[] arr;
using (MemoryStream ms = new MemoryStream())
{
img.Save(ms, thisFormat);
arr = ms.ToArray();
}
string convertedimg = "";
convertedimg = Convert.ToBase64String(arr);
Gears.RetriveData2("update dbo.ConvertedImage set ConvertedImage='" + convertedimg + "' where Keyfield = '" + dtrow[0].ToString() + "'", dtcon[0].ToString());
ClearCurrentConsoleLine();
Console.WriteLine("Converted: " + dtrow[0].ToString() + " , " + count.ToString() + " of " + convimage.Rows.Count);
}
}
if (count == dtconnection.Rows.Count)
{
Console.WriteLine("Conversion is Finished. Press enter key to exit.");
}
Console.ReadLine();
}
{{1}}
我尝试使用@ViewChild获取'搜索'但未定义 当我尝试使用@ViewChildren'搜索'时,我得到了
QueryList_dirty:false_emitter:EventEmitter_results:Array [1]更改:(...)dirty:(...)first:(...)last:(...)length:(...) proto :对象
答案 0 :(得分:0)
尝试添加此内容:
ngAfterViewChecked() { // Called after child views changed
if(this.showSearch && this.searchInput.first) { // check is showSearch and ViewChildren has result
this.searchInput.first.nativeElement.focus(); // set focus on native input element
}
}