TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Joshua Sparks
NA
13
0
Using an .ini file ??!!??
Mar 16 2009 12:22 PM
What I am trying to do, is allow the user to set the server ip, port, database and username in an .ini file.
Then I Am trying to take that info and import it into my c# code. I am new to c# so please be gentle .... Here is my code thus far
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace Pxi_Gm_Tool
{
public partial class addAccounts : Form
{
public addAccounts()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void addAccounts_Load(object sender, EventArgs e)
{
MySqlConnectionStringBuilder connBuilder =
new MySqlConnectionStringBuilder();
connBuilder.Add("Database", "pxi");
connBuilder.Add("Data Source", "localhost");
connBuilder.Add("User Id", "root");
connBuilder.Add("Password", "");
MySqlConnection connection =
new MySqlConnection(connBuilder.ConnectionString);
MySqlCommand cmd = connection.CreateCommand();
MySqlCommand command = connection.CreateCommand();
connection.Open();
try
{
command.CommandText = "INSERT INTO accounts (aident, pass, privs,status,created) VALUES (textbox1.text, textbox2.text, 5, 0, CURRENT_TIMESTAMP)";
connection.Close();
}
catch (Exception ex)
{
MessageBox.Show("Username in use");
}
}
}
}
Reply
Answers (
6
)
problem
How to close form 1 ?