Skip to content

Merge main into live #11245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ConnectionStrings": {
"DataGrid_CellSelection.Properties.Settings.AdventureWorksLT2008ConnectionString": "Data Source=jgalasyn1;Initial Catalog=AdventureWorksLT2008;Integrated Security=True"
"DataGrid_CellSelection.Properties.Settings.AdventureWorksLT2008ConnectionString": "Data Source=.;Initial Catalog=AdventureWorksLT2008;Integrated Security=True"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Data.Odbc" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
using System;
using System.Xml;
using System.Data;
using System.Data.Odbc;
using System.Data.Common;
using System.Windows.Forms;

public class Form1: Form
public class Example
{
protected DataSet DataSet1;
protected DataGrid dataGrid1;
// <Snippet1>
public void CreateOdbcConnection()
{
string connectionString = "...";

// <Snippet1>
public void CreateOdbcConnection()
{
string connectionString = "Driver={SQL Native Client};Server=(local);Trusted_Connection=Yes;Database=AdventureWorks;";
using (OdbcConnection connection = new(connectionString))
{
connection.Open();
Console.WriteLine($"ServerVersion: {connection.ServerVersion}"
+ $"\nDatabase: {connection.Database}");

using (OdbcConnection connection = new OdbcConnection(connectionString))
{
connection.Open();
Console.WriteLine("ServerVersion: " + connection.ServerVersion
+ "\nDatabase: " + connection.Database);

// The connection is automatically closed at
// the end of the Using block.
}
}
// </Snippet1>
// The connection is automatically closed at
// the end of the Using block.
}
}
// </Snippet1>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Data.Odbc" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static void Main(string[] args)
// <Snippet1>
private static void CreateOdbcConnection()
{
string connectionString = "Driver={SQL Native Client};Server=(local);Trusted_Connection=Yes;Database=AdventureWorks;";
string connectionString = "...";

using (OdbcConnection connection = new OdbcConnection(connectionString))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
using System;
using System.Xml;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Windows.Forms;
using Microsoft.Data.SqlClient;

public class Form1: Form
public class Form1 : Form
{
private DataSet DataSet1;
private DataGrid dataGrid1;

// <Snippet1>
// handler for RowUpdating event
private static void OnRowUpdating(object sender, SqlRowUpdatingEventArgs e)
Expand All @@ -25,40 +20,39 @@ private static void OnRowUpdated(object sender, SqlRowUpdatedEventArgs e)

public static int Main()
{
const string connectionString =
"Integrated Security=SSPI;database=Northwind;server=MSSQL1";
const string connectionString = "...";
const string queryString = "SELECT * FROM Products";

// create DataAdapter
SqlDataAdapter adapter = new SqlDataAdapter(queryString, connectionString);
SqlCommandBuilder builder = new SqlCommandBuilder(adapter);
SqlDataAdapter adapter = new(queryString, connectionString);
SqlCommandBuilder builder = new(adapter);

// Create and fill DataSet (select only first 5 rows)
DataSet dataSet = new DataSet();
DataSet dataSet = new();
adapter.Fill(dataSet, 0, 5, "Table");

// Modify DataSet
DataTable table = dataSet.Tables["Table"];
table.Rows[0][1] = "new product";

// add handlers
adapter.RowUpdating += new SqlRowUpdatingEventHandler( OnRowUpdating );
adapter.RowUpdated += new SqlRowUpdatedEventHandler( OnRowUpdated );
adapter.RowUpdating += new SqlRowUpdatingEventHandler(OnRowUpdating);
adapter.RowUpdated += new SqlRowUpdatedEventHandler(OnRowUpdated);

// update, this operation fires two events
// (RowUpdating/RowUpdated) per changed row
adapter.Update(dataSet, "Table");

// remove handlers
adapter.RowUpdating -= new SqlRowUpdatingEventHandler( OnRowUpdating );
adapter.RowUpdated -= new SqlRowUpdatedEventHandler( OnRowUpdated );
adapter.RowUpdating -= new SqlRowUpdatingEventHandler(OnRowUpdating);
adapter.RowUpdated -= new SqlRowUpdatedEventHandler(OnRowUpdated);
return 0;
}

private static void PrintEventArgs(SqlRowUpdatingEventArgs args)
{
Console.WriteLine("OnRowUpdating");
Console.WriteLine(" event args: ("+
Console.WriteLine(" event args: (" +
" command=" + args.Command +
" commandType=" + args.StatementType +
" status=" + args.Status + ")");
Expand All @@ -67,7 +61,7 @@ private static void PrintEventArgs(SqlRowUpdatingEventArgs args)
private static void PrintEventArgs(SqlRowUpdatedEventArgs args)
{
Console.WriteLine("OnRowUpdated");
Console.WriteLine( " event args: ("+
Console.WriteLine(" event args: (" +
" command=" + args.Command +
" commandType=" + args.StatementType +
" recordsAffected=" + args.RecordsAffected +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,91 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.20612</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F2593E93-91A2-4F64-88A4-7E3861B3FE01}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DataViewSamples</RootNamespace>
<AssemblyName>DataViewSamples</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Nonshipping>true</Nonshipping>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>

<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<SubType>Designer</SubType>
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.1" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

</Project>

This file was deleted.

Loading