PDA

View Full Version : Visual Studio


ctemes
03-22-09, 08:17 PM
Two questions:
1. How can I execute a SQL statement in a windows project (the database i attached to the project).
and
2. How do I make windows MDI children of an MDI main form?

Zhivago
03-22-09, 08:51 PM
I don't know exactly what it means to "attach" a database to a project, but the idiom is to establish a connection to the db and then build up and execute your query, and then process the result set. I believe Microsoft offers ADO for that sort of thing.

yehuda
03-23-09, 10:58 AM
You should really use entities framework or Linq to SQL if you develop for .net 3.5 (and maybe WPF while you're at it).

If not, I believe there is a designer where you can input SQL and execute it.
It's been a long time since I made windows forms and ado.net projects though.

ViN86
03-30-09, 08:17 PM
in order to execute SQL statements you need to use one of two things.

you either need to use a reference to a .dll file for databases such as MySQL or something similar, or you can use MS's builtin ADO statements.

http://en.wikipedia.org/wiki/ActiveX_Data_Objects

ADO is very easy to use. i have also used the MySQL extension and that is very easy as well. you just need to have the MySQL service running.

thor1182
04-03-09, 12:52 PM
_Login = new LogIn();
_Login.MdiParent = this;
_Login.WindowState = FormWindowState.Maximized;
_Login.UserLogIn += this.LogUserIn;
if (ActiveMdiChild != _LuaFinder)
{
if (ActiveMdiChild != null)
{
ActiveMdiChild.Hide();
}
_LuaFinder.Show();
}

I think is something close to what you are looking for the midi stuff. Thats with 3.5, and I don't know how different it is in the older frameworks (and I don't know if what I am doing is "correct", but it works).

Also if you are using 3.5, open up google and look up LINQ, do not pass go, do not collect $200. When you generate your DataContext object it should auto create the connection string for you.