Click here to Skip to main content
15,894,410 members
Home / Discussions / Database
   

Database

 
QuestionSQL server in to XML Pin
indian14313-Feb-07 19:37
indian14313-Feb-07 19:37 
AnswerRe: SQL server in to XML Pin
N a v a n e e t h13-Feb-07 21:42
N a v a n e e t h13-Feb-07 21:42 
GeneralRe: SQL server in to XML Pin
indian14322-Feb-07 21:01
indian14322-Feb-07 21:01 
Questionrelatioships & datasets? [sqlservr 2005 , C# 05] Pin
giddy_guitarist13-Feb-07 19:32
giddy_guitarist13-Feb-07 19:32 
AnswerRe: relatioships & datasets? [sqlservr 2005 , C# 05] Pin
Colin Angus Mackay13-Feb-07 19:38
Colin Angus Mackay13-Feb-07 19:38 
GeneralRe: relatioships & datasets? [sqlservr 2005 , C# 05] Pin
giddy_guitarist13-Feb-07 20:03
giddy_guitarist13-Feb-07 20:03 
GeneralRe: relatioships & datasets? [sqlservr 2005 , C# 05] Pin
Colin Angus Mackay13-Feb-07 21:55
Colin Angus Mackay13-Feb-07 21:55 
Generalsome newbie questions:[sqlservr 2005 , C# 05] Pin
giddy_guitarist16-Feb-07 4:32
giddy_guitarist16-Feb-07 4:32 
hi Colin,

I'm afraid i have to nag you for just a few more questions:

what i did was try to encapsulate your code into a method:
One in a public static class for filling a listbox:
public static void FillListBox(string query, ListBox theListbox)<br />
        {<br />
            using (SqlConnection conn = new SqlConnection(<br />
 @"Data Source=.\SQLEXPRESS;AttachDbFilename=|path|\Experiment.mdf;Integrated Security=True;User Instance=True"))<br />
            {<br />
                SqlCommand cmd = new SqlCommand(query, conn);<br />
                conn.Open();<br />
                SqlDataReader reader = cmd.ExecuteReader();<br />
                theListbox.Items.Clear();<br />
                while (reader.Read())<br />
                {<br />
                    theListbox.Items.Add(reader[0]);<br />
                }<br />
                reader.Close();<br />
                cmd.Dispose();<br />
                conn.Close();<br />
            }<br />
        }

And another local method to Execute inserts and deletes:

private void ExecEdit(string query)<br />
        {<br />
            using (SqlConnection conn = new SqlConnection(<br />
 @"Data Source=.\SQLEXPRESS;AttachDbFilename=|path|\Experiment.mdf;Integrated Security=True;User Instance=True"))<br />
            {<br />
                //code goes here<br />
                SqlCommand cmd = new SqlCommand(query, conn);<br />
                conn.Open();<br />
                cmd.ExecuteNonQuery();<br />
                cmd.Dispose();<br />
                conn.Close();<br />
<br />
            }<br />
        }

Basically ,i have a simple hotel app that uses access. I have to upgrade it, since everyone was just talking about sqlserv05 i decided to use it too lol.I cant exactly call myself proficient at C# and i hardly know much about dbs , and oh yea , i'm 16 Poke tongue | ;-P

My questions are:
1. Theres a good load because sometimes i need data often and this queries the DB and causes some slightly noticeable lag. Thats why i had the Dataset in mind. 50% of the time , i dont need *live* data. I realized i cant have a method that returns an SqlDataReader without a global open connection.So how do i cache raw?

2.I have a PersID column in the persons table.Should i let it be an autonumber or Generate some hash because customers once removed are stored in an archive table.New and archived customers should'nt have same IDs , i noticed that even if a delete a customer with ID=2 , the next customer has an ID:3 . But i'm curious about where this is stored? what if i wanted to purge the DB of all customers so ID will start from 1 again?

3. This is slightly embarrasing but Sniff | :^) , the thing i have to install on my clients pc is the file on this page thats 53 mb right?
http://msdn.microsoft.com/vstudio/express/sql/download/[^]
or is there a *smaller* runtime pack
I know i need this to automate the intall correct?:
http://msdn2.microsoft.com/en-us/library/bb264562.aspx[^]

Thanks so much
Gideon
GeneralRe: some newbie questions:[sqlservr 2005 , C# 05] Pin
Colin Angus Mackay16-Feb-07 6:47
Colin Angus Mackay16-Feb-07 6:47 
GeneralRe: some newbie questions:[sqlservr 2005 , C# 05] Pin
giddy_guitarist18-Feb-07 0:31
giddy_guitarist18-Feb-07 0:31 
GeneralRe: some newbie questions:[sqlservr 2005 , C# 05] Pin
Colin Angus Mackay18-Feb-07 1:12
Colin Angus Mackay18-Feb-07 1:12 
GeneralRe: some newbie questions:[sqlservr 2005 , C# 05] Pin
giddy_guitarist18-Feb-07 2:37
giddy_guitarist18-Feb-07 2:37 
Questionsql triggers Pin
kalyan_241613-Feb-07 17:21
kalyan_241613-Feb-07 17:21 
QuestionJob Name Pin
Member 382635313-Feb-07 11:59
Member 382635313-Feb-07 11:59 
AnswerRe: Job Name Pin
Ennis Ray Lynch, Jr.13-Feb-07 12:13
Ennis Ray Lynch, Jr.13-Feb-07 12:13 
AnswerRe: Job Name Pin
Harini N K21-Feb-07 22:35
Harini N K21-Feb-07 22:35 
QuestionOrder of operations and Short circuit Pin
Keith Andersch13-Feb-07 9:51
Keith Andersch13-Feb-07 9:51 
AnswerRe: Order of operations and Short circuit Pin
Pete O'Hanlon13-Feb-07 10:13
mvePete O'Hanlon13-Feb-07 10:13 
GeneralRe: Order of operations and Short circuit Pin
Keith Andersch13-Feb-07 10:33
Keith Andersch13-Feb-07 10:33 
GeneralRe: Order of operations and Short circuit Pin
M A A Mehedi Hasan13-Feb-07 23:25
M A A Mehedi Hasan13-Feb-07 23:25 
GeneralRe: Order of operations and Short circuit Pin
Pete O'Hanlon13-Feb-07 23:45
mvePete O'Hanlon13-Feb-07 23:45 
QuestionProgram can't connect with the server ,, vb.net 2005 Pin
kindman_nb13-Feb-07 8:49
kindman_nb13-Feb-07 8:49 
AnswerRe: Program can't connect with the server ,, vb.net 2005 Pin
Pete O'Hanlon13-Feb-07 9:24
mvePete O'Hanlon13-Feb-07 9:24 
GeneralRe: Program can't connect with the server ,, vb.net 2005 Pin
kindman_nb13-Feb-07 9:30
kindman_nb13-Feb-07 9:30 
GeneralRe: Program can't connect with the server ,, vb.net 2005 Pin
Pete O'Hanlon13-Feb-07 9:40
mvePete O'Hanlon13-Feb-07 9:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.