Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Using SQL and Visual Studio

Author  Topic 

CodeLearner2012
Starting Member

2 Posts

Posted - 2012-06-14 : 02:16:38
Hey everyone, I know this question is not entierly about SQL but hope someone may know how to help.

I am trying to build a 4x4 Sudoku game using SQL for the database tables and Visual Studio Windows forms with C# to develop the GUI's.

Now one of my forms is to add new puzzles which requires 16 texboxes set out in a 4x4 grid on visual studio, The user fills some textboxes with a numerical character and leaves the others blank (like a sudoku) as the user hits the 'add' button then the data needs to be recorded and saved onto the database table (in the appropriate columns).

This is the layout for the database table:
CREATE TABLE Puzzles
(
Puzzle_Code char(5) unique not null,
Difficulty varchar(15) not null,
SQ1 char(1),
SQ2 char(1),
SQ3 char(1),
SQ4 char(1),
SQ5 char(1),
SQ6 char(1),
SQ7 char(1),
SQ8 char(1),
SQ9 char(1),
SQ10 char(1),
SQ11 char(1),
SQ12 char(1),
SQ13 char(1),
SQ14 char(1),
SQ15 char(1),
SQ16 char(1),
Solution Bigint not null,
Primary Key (Puzzle_Code)
);

GUI is presented in order left to right, top to bottom
SQ1 SQ2 SQ3 SQ4
SQ5 6 7 8
9 10 11 12
13 14 15 16

How do i save the data inputed in the textboxes even if its a null, as the user hits the 'add' button??

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-06-14 : 02:22:08
Check out this
http://beyondrelational.com/puzzles/challenges/97/a-tsql-sudoku.aspx


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

CodeLearner2012
Starting Member

2 Posts

Posted - 2012-06-14 : 02:28:41
Thank you for the reply khtan, however i already have the data and have filled the table, i just need to know how to add and save the data the user inputs into the GUI, into the table in the appropriate order.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-06-14 : 02:37:55
Maybe you should reconsider the design. Having a row and column is much easier to handle than reference the column SQxx.


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -