-
C# 在LINQ to DataSet中对分组操作执行子查询
C# 在LINQ to DataSet中对分组操作执行子查询,相关代码:
private void button1_Click(object sender, EventArgs e)
{//在LINQ to DataSet中对分组操作执行子查询
SqlConnection MyConnection = new SqlConnection();
MyConnection.ConnectionString = @"Data Source =.SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True";
MyConnection.Open();
SqlCommand MyCommand = new SqlCommand("Select * From Orders ", MyConnection);
DataSet MySet = new DataSet();
SqlDataAdapter MyAdapter = new SqlDataAdapter(MyCommand);
MyAdapter.Fill(MySet);
DataTable MyQueryTable = MySet.Tables[0];
var MyQuery = from MyOrder in MyQueryTable.AsEnumerable()
orderby MyOrder.Field("ShipCity")
group MyOrder by MyOrder.Field("ShipCity") into g
select new
{
MyCity = g.Key,
MyMaxFreight = (from MyData in g select MyData.Field("Freight")).Max()
- 2022-01-27 20:20:32下载
- 积分:1
-
C# 操作泛型绑定列表BindingList
C#创建泛型绑定列表,操作泛型绑定列表BindingList,在本代码中将完成为泛型绑定列表添加元素,然后过滤、排序泛型绑定列表,最后显示显示查询结果。主要应用于比较大型的数据运算,此前有关泛型数据的各类操作,www.srcfans.com已经收集了不少,请通过分类标签或搜索源代码查看。
- 2022-07-08 21:34:33下载
- 积分:1
-
C# wpf方法的最大化和最小化窗口
Viaual C# 使用wpf方法实现最大化和最小化窗口,和默认的方式似乎有些不同.有兴趣的可参考以下代码:
private void button1_Click(object sender, RoutedEventArgs e)
{//最大化显示窗口
this.WindowState = System.Windows.WindowState.Maximized;
}
private void button2_Click(object sender, RoutedEventArgs e)
{//最小化显示窗口
this.WindowState = System.Windows.WindowState.Minimized;
}
private void button3_Click(object sender, RoutedEventArgs e)
{//还原窗口
this.WindowState = System.Windows.WindowState.Normal;
}
private void button4_Click(object sender, RoutedEventArgs e)
{//关闭窗口
this.Close();
}
- 2022-01-25 15:01:45下载
- 积分:1
-
C# 启动和关闭无窗体定时器
C# 启动和关闭无窗体定时器,单击窗体上对应的按钮,即可完成无窗体定时器的启动和关闭功能,核心代码为:
private void button1_Click(object sender, EventArgs e)
{//启动无窗体定时器
var MyClass = new MyThreadClass();
MyTimer = new System.Threading.Timer(MyClass.MyCallBackMethod, MyClass, 5000, 2000);
}
private void button2_Click(object sender, EventArgs e)
{//关闭无窗体定时器
MyTimer.Dispose();
}
- 2022-04-09 03:53:39下载
- 积分:1
-
C# 制作一个顶层显示的窗口-不被其它窗口遮挡
C#设置顶层显示的窗口,让窗口显示在其它窗口的最上面,不被遮挡,这种窗口形式或许大家平时都见到过,特别是一些视频播放器,在播放视频的时候,都可以设置是否顶层显示,本示例就是模拟了这个功能,通过“允许以最顶层方式显示窗口”和“禁止以最顶层方式显示窗口”来模拟启用和关闭顶层窗口的功能,代码貌似简单:
private void button1_Click(object sender, RoutedEventArgs e)
{//允许以最顶层方式显示窗口
this.Topmost = true;
}
private void button2_Click(object sender, RoutedEventArgs e)
{//禁止以最顶层方式显示窗口
this.Topmost = false;
}
- 2023-05-27 13:10:03下载
- 积分:1
-
C# 从RichTextBox 控件中提取文本内容
C# 从RichTextBox 控件中提取文本内容,并设置RichTextBox 控件中的字体大小-附完整源代码,
private void button1_Click(object sender, RoutedEventArgs e)
{//从RichTextBox 控件中提取文本内容
TextRange MyText = new TextRange(this.richTextBox1.Document.ContentStart, this.richTextBox1.Document.ContentEnd);
MessageBox.Show(MyText.Text, "RichTextBox控件中的文本内容",MessageBoxButton.OK);
}
private void button2_Click(object sender, RoutedEventArgs e)
{//设置RichTextBox 控件中的字体大小
TextRange MyText = new TextRange(this.richTextBox1.Document.ContentStart, this.richTextBox1.Document.ContentEnd);
MyText.ApplyPropertyValue(TextElement.FontSizeProperty, 36.00);
MyText.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold);
- 2022-09-21 17:55:02下载
- 积分:1
-
STM32F1的SPWM逆变器源码
#include "SPWM.h"
#include "led.h"
#include "usart.h"
u16 TimerPeriod = 7200;
u16 DutyFactor = 50;
void TIM_Int_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
NVIC_InitTypeDef NVIC_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4 | RCC_APB1Periph_TIM3,ENABLE); //时钟使能
/* GPIOA配置:通道PA.6和PA.7作为输出引脚*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
&nbs
- 2022-07-26 17:50:34下载
- 积分:1
-
某超市进销存管理系统(C++_Oracle开发源码)
某超市进销存管理系统(C++_Oracle开发源码)
- 2022-11-23 22:55:04下载
- 积分:1
-
C# 最简单的文件复制实例
C# 最简单的文件复制实例,文件拷贝的示例,比较简单,若要启用启用xp_cmdshell, 请查看启用xp_cmdshell使用说明。
- 2022-03-01 11:06:17下载
- 积分:1
-
C# 一些图像变换处理的演示效果附源码
C# 一些图像变换处理的演示效果附源码,比如旋转变换、剪切变换、缩放变换、平移变换、单色变换等。
用户在本演示窗口中点击对应的按钮,即可看到对应的图片变换效果。
每种变换的代码,请下载源码后参见Form1.cs文件。
- 2022-02-21 19:33:23下载
- 积分:1