本文整理汇总了C#中System.Data.SqlClient.SqlCommand.ExecuteReaderExt方法的典型用法代码示例。如果您正苦于以下问题:C# SqlCommand.ExecuteReaderExt方法的具体用法?C# SqlCommand.ExecuteReaderExt怎么用?C# SqlCommand.ExecuteReaderExt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SqlClient.SqlCommand
的用法示例。
在下文中一共展示了SqlCommand.ExecuteReaderExt方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _init
private void _init()
{
using (SqlCommand cmd = new SqlCommand()
{
CommandType = CommandType.Text,
CommandText = "SELECT TOP 1 * FROM Weather WHERE [email protected]",
})
{
cmd.Parameters.AddWithValue("@frameId", this.FrameId);
cmd.ExecuteReaderExt((dr) =>
{
return false;
});
}
// TODO: add own Woeid to Weather model
/*Location location = new Location(DisplayId);
if (location.LocationId != 0)
{
Woeid = location.Woeid;
TemperatureUnit = location.TemperatureUnit;
}
else
{
Woeid = 56199578; // Old Sacramento
TemperatureUnit = "f";
}*/
}
示例2: Panel
public Panel(int panelId)
{
using (SqlCommand cmd = new SqlCommand()
{
CommandType = CommandType.Text,
CommandText = "SELECT TOP 1 * FROM Panel WHERE [email protected]",
})
{
cmd.Parameters.AddWithValue("@panelId", panelId);
cmd.ExecuteReaderExt((dr) =>
{
_initFromRow(dr);
return false;
});
}
}
示例3: Location
public Location(int displayId)
{
using (SqlCommand cmd = new SqlCommand()
{
CommandType = CommandType.Text,
CommandText = "exec dbo.sp_GetLocationDetails @displayId",
})
{
cmd.Parameters.AddWithValue("@displayId", displayId);
cmd.ExecuteReaderExt((r) =>
{
_initFromRow(r);
return false;
});
}
}
示例4: List
public static List<Panel> List(int canvasId)
{
List<Panel> list = new List<Panel>();
using (SqlCommand cmd = new SqlCommand()
{
CommandType = CommandType.Text,
CommandText =
"SELECT p.*, f.PanelId FsPanelId, c.Height CanvasHeight, c.Width CanvasWidth FROM Panel p " +
"INNER JOIN Canvas c on c.CanvasId=p.CanvasId " +
"LEFT JOIN FullScreen f on f.PanelId=p.PanelId WHERE [email protected] ORDER BY p.PanelId",
})
{
cmd.Parameters.AddWithValue("@canvasId", canvasId);
cmd.ExecuteReaderExt((r) =>
{
Panel panel = null;
int panelId = r.IntOrZero("PanelId");
int fullScreenPanelId = r.IntOrZero("FsPanelId");
if (panelId == fullScreenPanelId)
panel = new FullScreenPanel()
{
PanelId = panelId,
Top = 0,
Left = 0,
Height = r.IntOrZero("CanvasHeight"),
Width = r.IntOrZero("CanvasWidth"),
Name = r.StringOrBlank("Name"),
FadeLength = r.ValueOrDefault<double>("FadeLength", 0),
};
else
panel = new Panel()
{
PanelId = panelId,
Top = r.IntOrZero("Top"),
Left = r.IntOrZero("Left"),
Height = r.IntOrZero("Height"),
Width = r.IntOrZero("Width"),
Name = r.StringOrBlank("Name"),
FadeLength = r.ValueOrDefault<double>("FadeLength", 0),
};
if (panel.Name == "")
panel.Name = string.Format("Panel {0}", panelId);
list.Add(panel);
return true;
});
}
return list;
}
示例5: IsFullScreen
public static bool IsFullScreen(int panelId)
{
bool isFullScreen = false;
using (SqlCommand cmd = new SqlCommand()
{
CommandType = CommandType.Text,
CommandText = "SELECT TOP 1 * FROM Panel WHERE [email protected]",
})
{
cmd.Parameters.AddWithValue("@panelId", panelId);
cmd.ExecuteReaderExt((dr) =>
{
isFullScreen = true;
return false;
});
}
return isFullScreen;
}
示例6: _init
private void _init()
{
using (SqlCommand cmd = new SqlCommand()
{
CommandType = CommandType.Text,
CommandText = "SELECT TOP 1 * FROM Youtube WHERE [email protected]",
})
{
cmd.Parameters.AddWithValue("@frameId", this.FrameId);
cmd.ExecuteReaderExt((dr) =>
{
YoutubeId = dr.StringOrBlank("YoutubeId").Trim();
AutoLoop = dr.Boolean("AutoLoop");
Volume = dr.IntOrZero("Volume");
Aspect = dr.IntOrZero("Aspect");
Quality = dr.IntOrZero("Quality");
Start = dr.IntOrZero("Start");
Rate = dr.IntOrZero("Rate");
return false;
});
}
}
示例7: _init
private void _init()
{
using (SqlCommand cmd = new SqlCommand()
{
CommandType = CommandType.Text,
CommandText = "SELECT TOP 1 f.*, t.FrameType, t.Html, t.Name TemplateName FROM Frame f inner join Template t on t.TemplateId=f.TemplateId WHERE [email protected]",
})
{
cmd.Parameters.AddWithValue("@frameId", this.FrameId);
cmd.ExecuteReaderExt((dr) =>
{
this._initfromRow(dr);
return false;
});
}
}
示例8: Display
public Display(int displayId)
{
using (SqlCommand cmd = new SqlCommand()
{
CommandType = CommandType.Text,
CommandText = "SELECT TOP 1 * FROM Display WHERE [email protected]",
})
{
cmd.Parameters.AddWithValue("@displayId", displayId);
cmd.ExecuteReaderExt((r) =>
{
_initFromRow(r);
return false;
});
}
}
示例9: _init
private void _init()
{
using (SqlCommand cmd = new SqlCommand()
{
CommandType = CommandType.Text,
CommandText = "SELECT TOP 1 * FROM Powerbi WHERE [email protected]",
})
{
cmd.Parameters.AddWithValue("@frameId", FrameId);
cmd.ExecuteReaderExt((dr) =>
{
TargetUrl = dr.StringOrBlank("Url").Trim();
Action = (Models.PowerbiTypes)dr.IntOrZero("Type") == Models.PowerbiTypes.PowerbiType_Report ? "loadReport" : "loadTile";
AccountId = dr.IntOrZero("AccountId");
return false;
});
}
}
示例10: List
public static List<Location> List(int levelId = 0)
{
List<Location> list = new List<Location>();
using (SqlCommand cmd = new SqlCommand()
{
CommandType = CommandType.Text,
CommandText =
"select l.*, v.Name Name2 from Location l inner join Level v on v.LevelId=l.LevelId " +
"where @levelId=0 or [email protected] order by v.Name, l.Name;",
})
{
cmd.Parameters.AddWithValue("@levelId", levelId);
cmd.ExecuteReaderExt((r) =>
{
Location loc = new Location();
loc._initFromRow(r);
string name2 = r.StringOrBlank("Name2").Trim();
loc.Name = string.Format("{0} : {1}",
name2 == "" ? string.Format("Level {0}", loc.LevelId) : name2,
loc.Name
);
list.Add(loc);
return true;
});
}
return list;
}
示例11: _init
private void _init()
{
using (SqlCommand cmd = new SqlCommand()
{
CommandType = CommandType.Text,
CommandText = "SELECT TOP 1 o.*, Account, Password, Url, EwsVersion FROM Outlook o inner join ExchangeAccount x on x.AccountId=o.AccountId WHERE [email protected]",
})
{
cmd.Parameters.AddWithValue("@frameId", FrameId);
cmd.ExecuteReaderExt((dr) =>
{
Account = dr.StringOrBlank("Account").Trim();
Password = (byte[])dr["Password"];
Mode = dr.IntOrZero("Mode");
EwsVersion = (ExchangeVersion)dr.IntOrZero("EwsVersion");
ShowEvents = dr.IntOrZero("ShowEvents");
if (ShowEvents < 0)
ShowEvents = 0;
Mailbox = dr.StringOrBlank("Mailbox").Trim();
if (string.IsNullOrWhiteSpace(Mailbox))
Mailbox = Account;
Name = dr.StringOrBlank("Name").Trim();
URL = dr.StringOrBlank("Url").Trim();
Privacy = (DisplayMonkey.Models.OutlookPrivacy)dr.IntOrZero("Privacy");
AllowReserve = dr.Boolean("AllowReserve");
ShowAsFlags = dr.IntOrZero("ShowAsFlags");
return false;
});
}
}
示例12: _init
private void _init()
{
using (SqlCommand cmd = new SqlCommand()
{
CommandType = CommandType.Text,
CommandText = "SELECT TOP 1 i.*, Name FROM Picture i INNER JOIN Content c ON c.ContentId=i.ContentId WHERE [email protected]",
})
{
cmd.Parameters.AddWithValue("@frameId", FrameId);
cmd.ExecuteReaderExt((dr) =>
{
ContentId = dr.IntOrZero("ContentId");
Mode = (RenderModes)dr.IntOrZero("Mode");
Name = dr.StringOrBlank("Name");
return false;
});
}
}
示例13: _init
private void _init()
{
using (SqlCommand cmd = new SqlCommand()
{
CommandType = CommandType.Text,
CommandText = "SELECT TOP 1 * FROM Clock WHERE [email protected]",
})
{
cmd.Parameters.AddWithValue("@frameId", this.FrameId);
cmd.ExecuteReaderExt((dr) =>
{
this.ShowDate = dr.Boolean("ShowDate");
this.ShowTime = dr.Boolean("ShowTime");
this.ShowSeconds = dr.Boolean("ShowSeconds");
this.Type = dr.IntOrZero("Type");
this.Label = dr.StringOrDefault("Label", null);
string szTimeZoneId = dr.StringOrDefault("TimeZone", null);
if (szTimeZoneId != null)
this.TimeZone = TimeZoneInfo.FindSystemTimeZoneById(szTimeZoneId);
return false;
});
}
}