C++ Archive
string s = “”+chでうまく代入されない
- 2010-06-20 (Sun)
- C++
char ch='A'; string s = ""+ch; cout << s << endl;
これ実行すると,Aが出力されない.なーんでだ
- Comments: 0
- Trackbacks: 0
DataGridView の行を削除する
- 2010-05-12 (Wed)
- C++
DataGridView->Rows->Clear() ではエラーになるでーす
DataSetをクリア、DataTableをクリア、などの方法でできるらしいだ。
- Comments: 0
- Trackbacks: 0
DataSet + BindingNavigator + TextBox
- 2010-05-09 (Sun)
- C++
Windows フォームのプログラミング
#using <System.dll>
#using <System.Data.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>
#using <System.EnterpriseServices.dll>
#using <System.Transactions.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::Collections::Generic;
using namespace System::ComponentModel;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Data::SqlClient;
using namespace System::Windows::Forms;
// This form demonstrates using a BindingNavigator to display
// rows from a database query sequentially.
public ref class Form1 : public Form
{
// This is the BindingNavigator that allows the user
// to navigate through the rows in a DataSet.
BindingNavigator^ customersBindingNavigator;
// This is the BindingSource that provides data for
// the Textbox control.
BindingSource^ customersBindingSource;
// This is the TextBox control that displays the CompanyName
// field from the the DataSet.
TextBox^ companyNameTextBox;
public:
Form1()
{
// Set up the BindingSource component.
this->customersBindingSource = gcnew BindingSource();
this->companyNameTextBox = gcnew TextBox();
this->customersBindingNavigator = gcnew BindingNavigator();
this->customersBindingNavigator->BindingSource =
this->customersBindingSource;
this->customersBindingNavigator->Dock = DockStyle::Top;
this->Controls->Add(this->customersBindingNavigator);
// Set up the TextBox control for displaying company names.
this->companyNameTextBox->Dock = DockStyle::Bottom;
this->Controls->Add(this->companyNameTextBox);
// Set up the form.
this->Size = System::Drawing::Size(800, 200);
this->Load += gcnew EventHandler(this, &Form1::Form1_Load);
}
private:
void Form1_Load(Object^ sender, EventArgs^ e)
{
// Open a connection to the database.
// Replace the value of connectString with a valid
// connection string to a Northwind database accessible
// to your system.
String^ connectString =
"Integrated Security=SSPI;Persist Security Info=False;" +
"Initial Catalog=Northwind;Data Source=localhost";
SqlConnection^ connection = gcnew SqlConnection();
connection->ConnectionString = connectString;
connection->Open();
// Execute the query.
SqlCommand^ command = gcnew SqlCommand(
"Select * From Customers", connection);
SqlDataReader^ reader = command->ExecuteReader(
CommandBehavior::CloseConnection);
// Load the Customers result set into the DataSet.
DataSet^ ds = gcnew DataSet("Northwind Customers");
ds->Load(reader, LoadOption::OverwriteChanges,
gcnew array<String^> {"Customers"});
// Assign the DataSet as the DataSource for the
// BindingSource.
this->customersBindingSource->DataSource = ds->Tables[0];
// Bind the CompanyName field to the TextBox control.
this->companyNameTextBox->DataBindings->Add(gcnew Binding("Text",
this->customersBindingSource, "CompanyName", true));
}
};
http://msdn.microsoft.com/ja-jp/library/s4b01sz7%28VS.80%29.aspx
- Comments: 0
- Trackbacks: 0
Visual C++.NET + MySQL
- 2010-05-08 (Sat)
- C++
Visual C++ .NET 2008 で,MySQLを扱いたい.
DataSet, BindingSource, BindingNavigator, DataTable, DataSetが何なのかわからなーい
ぐぐってたらいいサイトあったでーす★
http://itpro.nikkeibp.co.jp/article/COLUMN/20070320/265659/?ST=develop&P=1
- Comments: 0
- Trackbacks: 0
const System::String ^ から System::String ^の変換
- 2010-04-29 (Thu)
- C++
const System::String ^ to System::String ^の変換はどうすればいいのでしょう?
- Comments: 0
- Trackbacks: 0
VC++.NETにおけるNULL
- 2010-04-29 (Thu)
- C++
VC++ .NET 2008 におけるNULL は nullptr なのかな?
- Comments: 0
- Trackbacks: 0
error C2065: ‘String’ : undeclared identifier
- 2010-04-28 (Wed)
- C++
http://www.gamedev.net/community/forums/topic.asp?topic_id=276647
string.h contains the C string functions (strcmp, strcat, etc.) The C++ string header is <string>, the string class is called std::string
- Comments: 0
- Trackbacks: 0
Cannot add data source in VC++ .NET 2008
- 2010-04-20 (Tue)
- C++
Visual Studio 2008 上で,MySQLを使いたいなーと思ってた.
データソースを追加するとき,問題が発生.

データソースの追加に,オブジェクトしかない.C#で見てみると,データベース等の項目がある.
http://social.msdn.microsoft.com/Forums/ja-JP/vcgeneralja/thread/02b409f6-5576-48b8-9023-1d06bca7f358
https://connect.microsoft.com/VisualStudio/feedback/details/292118/cannot-add-data-source-in-c-cli-winforms-project
http://quickprogram.blogspot.com/2008/10/vc-2008-express-datagridviewdatasource.html
どうやら,VC++.NET 2008 ではできないらしい.
- Comments: 0
- Trackbacks: 0
- Search
- Feeds
- Meta
-
