i need help
-
hi guys i have table in sqlserver database named tels has columns tels_no , tels_name , tels_cost ok i want to enter a no in a textbox in the application then auto it get data of this no and set this in two different textboxes one for tels_name and other for tels_cost how?????????? i do not know thanks, Mohamed El-Wehishy
-
hi guys i have table in sqlserver database named tels has columns tels_no , tels_name , tels_cost ok i want to enter a no in a textbox in the application then auto it get data of this no and set this in two different textboxes one for tels_name and other for tels_cost how?????????? i do not know thanks, Mohamed El-Wehishy
-
Yeah, great answer. I'd mark it as "bestest ever" but the developers of this site probably never knew you'd come along...
Blikkies wrote:
You can use ADO.net or data set to get you data from DB.
What the hell does that bring to anything? It's like somebody asked: "I'm having trouble fitting windows in my house, I know where I want them and I have a fitting kit for them" and you answered "You can use a hammer or its handle to bang nails into a wall." As for the author of the question, you'd be better off reading a book on C# and/or a tutorial online. Rome was not built in a day.
var question = (_2b || !(_2b));
-
Yeah, great answer. I'd mark it as "bestest ever" but the developers of this site probably never knew you'd come along...
Blikkies wrote:
You can use ADO.net or data set to get you data from DB.
What the hell does that bring to anything? It's like somebody asked: "I'm having trouble fitting windows in my house, I know where I want them and I have a fitting kit for them" and you answered "You can use a hammer or its handle to bang nails into a wall." As for the author of the question, you'd be better off reading a book on C# and/or a tutorial online. Rome was not built in a day.
var question = (_2b || !(_2b));
-
hi guys i have table in sqlserver database named tels has columns tels_no , tels_name , tels_cost ok i want to enter a no in a textbox in the application then auto it get data of this no and set this in two different textboxes one for tels_name and other for tels_cost how?????????? i do not know thanks, Mohamed El-Wehishy
SqlConnection conn = new SqlConnection(@"user id=sa; Password=pass; initial catalog=databaseName; Data source=localhost");
conn.Open();
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT * FROM Tabel WHERE tels_no = '"+textbox1.Text.Replace("'","")+"'";
SqlDataReader reader = cmd.ExecuteReader();
while(reader.Read())
{
TextBox2.Text = reader["tels_name"].ToString();
}Use following namespaces: using System.Data; using System.Data.SqlClient;
-
Yeah, great answer. I'd mark it as "bestest ever" but the developers of this site probably never knew you'd come along...
Blikkies wrote:
You can use ADO.net or data set to get you data from DB.
What the hell does that bring to anything? It's like somebody asked: "I'm having trouble fitting windows in my house, I know where I want them and I have a fitting kit for them" and you answered "You can use a hammer or its handle to bang nails into a wall." As for the author of the question, you'd be better off reading a book on C# and/or a tutorial online. Rome was not built in a day.
var question = (_2b || !(_2b));
:laugh: yesssssss man you are right sorry for this silly question Mohamed El-Wehishy
-
SqlConnection conn = new SqlConnection(@"user id=sa; Password=pass; initial catalog=databaseName; Data source=localhost");
conn.Open();
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT * FROM Tabel WHERE tels_no = '"+textbox1.Text.Replace("'","")+"'";
SqlDataReader reader = cmd.ExecuteReader();
while(reader.Read())
{
TextBox2.Text = reader["tels_name"].ToString();
}Use following namespaces: using System.Data; using System.Data.SqlClient;
ARGH!! Never build SQL queries concatenating strings! Have you never heard of SQL injection attacks?
-
hi guys i have table in sqlserver database named tels has columns tels_no , tels_name , tels_cost ok i want to enter a no in a textbox in the application then auto it get data of this no and set this in two different textboxes one for tels_name and other for tels_cost how?????????? i do not know thanks, Mohamed El-Wehishy
Please, please, purrrrleeees stop using "I need help" for every topic line. Use something like "Problem retrieving data", or similar. Errm...., obviously not if it's a Graphics question but you know what I mean. :)
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
ARGH!! Never build SQL queries concatenating strings! Have you never heard of SQL injection attacks?
-
ARGH!! Never build SQL queries concatenating strings! Have you never heard of SQL injection attacks?
-
1 - your code does NOT stop injection attacks 2 - if you give people here code, they are likely to use it verbatim, not ever understand it 3 - why give people examples they shouldn't use ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.