|
-
February 12th, 2010, 08:09 AM
#16
Re: Questions regarding C#
OK in that case, sorry about my missunderstanding.
-
February 12th, 2010, 08:45 AM
#17
Re: Questions regarding C#
A solution to one of my problems: Inserting data in DB:
databaseDataContext db = new databaseDataContext();
var newCustomer = new User
{
Username = textBox1.Text,
Password = textBox2.Text,
};
db.Users.InsertOnSubmit(newCustomer);
db.SubmitChanges();
Hope this helps to somebody. Now I want to create something like a menu based on a DB:
A table named Table1
with columns: ID(prim key, auto increase)
Name
Information
A winform that will display the data from Column Name like links and when I click an record on that menu it will open form2 and will display the things from Information in textbox. I am sure that ti can be done easily, but can't actually do it myself.
-
February 12th, 2010, 09:17 AM
#18
Re: Questions regarding C#
Dude what is the problem with your code or program? please make it clear because someone taught me a way to my problem too and it does not give any error either but my database is not updating at all....
-
February 12th, 2010, 11:31 AM
#19
Re: Questions regarding C#
We have turned it in to a chat but nevermind... Actually i noticed that this does NOT update the DB.. Not sure what is the problem too. I have a datagridview in my program, 2 textboxes and 2 buttons, when I enter Data1 and Data2 in textbox1 and textbox2 and click button 1 it SHOULD insert te data in the DB, and when I click button 2 the data really shows in the datagrid(!), but when I check the DB there is nothing in it...Its weird, as I am getting the things from a book, but I guess I am wrong somewhere. I will be really glad if someone can solve our problems
-
February 14th, 2010, 03:19 AM
#20
Re: Questions regarding C#
Usually what happens is the db is copied into the \debug folder when building the project. You run your program which uses the db in the \debug folder, make the changes which get stored in the db and then quit the program.
The next time you run the program, the db from your project gets copied over to the \debug folder so when you open the app it looks like the db didn't get written.
What you can do is temporarily hardcode the path to the db to a fixed location that won't get overwritten (like point it to the db in the project folder, not the \debug folder).
-
February 14th, 2010, 03:37 AM
#21
Re: Questions regarding C#
Great!! I cant Explain the degree of Happiness right now...Thank You very Much......Leaving the development phase apart does that mean that I can now create the Installer Of my application with a database file in it and it will work on other application??
-
February 14th, 2010, 04:59 AM
#22
Re: Questions regarding C#
 Originally Posted by rocky_upadhaya
Great!! I cant Explain the degree of Happiness right now...Thank You very Much......Leaving the development phase apart does that mean that I can now create the Installer Of my application with a database file in it and it will work on other application??
Who knows? That's what testing is for.
-
February 14th, 2010, 06:41 AM
#23
Re: Questions regarding C#
Thanks for the asnwers. I have noticed hat myself too yesterday.
Now I am stuck at cerating a database driven menu - a menu that uses that from the database. I can only fins tuts about asp.net and I am working on windows applications...
-
February 14th, 2010, 02:01 PM
#24
Re: Questions regarding C#
Essentially, you read the data out of a the database and use it to create the menu structure. The actual menu creation code might be a bit different from the ASP.Net, but the rest is the same.
I would start by creating some menus in code. To help with this I would create a single 'universal' menu handler and assign it to all the menu items I've created. If you set the id of the menu item properly, then you should be able to determine what menu item you are acting on in the 'universal' menu handler and then take appropriate action.
Once you can create menu items on-the-fly in code, then you can figure out how to read the menu structure out of the database (and then reuse the code from above to dynamically create the menu items).
Say, if you have any more related questions on menus, please create a new post.
-
February 15th, 2010, 12:43 AM
#25
Re: Questions regarding C#
I'm coming in at the end here, but if the local database is very simple, consider using an XML file instead of relying on the presence of SQL Server Express etc.
Dataset.Read/WriteXML(fileName).... check it out.
Rob
-
Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......
-
February 15th, 2010, 01:24 AM
#26
Re: Questions regarding C#
well how about using sql compact database. why to use compact instead of sql server edition...
-
February 15th, 2010, 01:27 AM
#27
Re: Questions regarding C#
 Originally Posted by rocky_upadhaya
well how about using sql compact database. why to use compact instead of sql server edition...
Why not type "Sql Server feature comparison" in google and let Microsoft explain the differences to you?
http://msdn.microsoft.com/en-us/library/cc645993.aspx
http://msdn.microsoft.com/en-us/library/ms144275.aspx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|