hi guys. its been a long time but sincerely, am happy to be back. now i've got a problem on my mind and that is; am trying to develop a database application but i want it to be a console application. the major issue is that i dont know how to go about connecting vb.net console application to sql server or if its possible at all, but am sure its possible in this world of ours....love you all.
you make Connection to the DB
and send it String commands
Dim SqlDataReader Sdr1 = new SqlCommand("Select A, B, C, D FROM XYZ",MyConnetion).ExecuteReader()
Console.WriteLine(Sdr1.GetInt32(0)) 'Assuming A is of type int in the table
Console.WriteLine(Sdr1.GetString(1)) 'Assuming B is of type String in the table
Console.WriteLine(Sdr1.GetBoolean(2)) 'Assuming C is of type Bool in the table
I assume You understand why I use 0,1,2. If not then that is how you called them in the Select statement.
For Update just do
new SqlCommand("UPDATE XYZ SET A = 7",MyConnection).ExecuteNonQuery()
new SqlCommand("INSERT INTO XYZ (A,B,C) VALUES (7,'Hello World','True')",MyConnection).ExecuteNonQuery()