Sintax problem
-
Let's say I have in index.aspx.cs Page_load():
int id=1;
And I have a gridview populated by MS SQL, and I have the following selectcommand:
SelectCommand="SELECT * FROM [Filmes] WHERE [ID_Users]=' id '"
I need to use that variable that way. Is it possible? What is the correct syntax? I tried many ways but cant do it. Really appreciate your help.
-
Let's say I have in index.aspx.cs Page_load():
int id=1;
And I have a gridview populated by MS SQL, and I have the following selectcommand:
SelectCommand="SELECT * FROM [Filmes] WHERE [ID_Users]=' id '"
I need to use that variable that way. Is it possible? What is the correct syntax? I tried many ways but cant do it. Really appreciate your help.
The syntax you are after is this: SelectCommand="SELECT * FROM [Filmes] WHERE [ID_Users]= " & id However, I would strongly recommend you use a stored procedure rather than SQL embedded in your code.
I don't have ADHD, I have ADOS... Attention Deficit oooh SHINY!! Booger Mobile (n) - A bright green 1964 Ford Falcon - our entry into the Camp Quality esCarpade!! Do something wonderful - make a donation to Camp Quality today!!
-
The syntax you are after is this: SelectCommand="SELECT * FROM [Filmes] WHERE [ID_Users]= " & id However, I would strongly recommend you use a stored procedure rather than SQL embedded in your code.
I don't have ADHD, I have ADOS... Attention Deficit oooh SHINY!! Booger Mobile (n) - A bright green 1964 Ford Falcon - our entry into the Camp Quality esCarpade!! Do something wonderful - make a donation to Camp Quality today!!
-
You have been given this advise before. Time to take heed. If you want to learn how to code, learn it right.
I know the language. I've read a book. - _Madmatt
-
Maxdd 7 wrote:
One step at the time
You say that and yet you post asking about every topic under the sun, without ever taking the time to properly learn anyting, or consider any of the good advice you are given
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.
-
Maxdd 7 wrote:
One step at the time
You say that and yet you post asking about every topic under the sun, without ever taking the time to properly learn anyting, or consider any of the good advice you are given
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.
Well, Those are two different questions. Maybe I should read some things first, that is one mistake and I assume. Regarding the good advice I received, I consider them. I just no apply them for now, because I believe I should not try drive a truck, when I dont know how to drive a car.
-
Well, Those are two different questions. Maybe I should read some things first, that is one mistake and I assume. Regarding the good advice I received, I consider them. I just no apply them for now, because I believe I should not try drive a truck, when I dont know how to drive a car.
That's the point you are missing, you are trying to taught how to ride a bike before you get near the car.
I know the language. I've read a book. - _Madmatt
-
That's the point you are missing, you are trying to taught how to ride a bike before you get near the car.
I know the language. I've read a book. - _Madmatt
I know you are right I'm just trying to make you understand my point of view. Until some days ago, I never coded a line of C# and used ASP.NET controls. I dont have a book (or e-book) or anyone I know who could teach me. The few I learn, was throught google, and even by google it could be difficult find the information I need. There are so many things of ASP.NET (I never imagined!), and then exists .NET 1.1, 2.0, 3.0 (...) VB.NET, older versions, near versions (...) Sometimes it could be difficult start coding in this conditions, because I dont know where to stand, where to look. But ok, from now on, I will try to follow your advices, and just post questions (if necessary) about it. My apologies for any incovenience.
-
Well, Those are two different questions. Maybe I should read some things first, that is one mistake and I assume. Regarding the good advice I received, I consider them. I just no apply them for now, because I believe I should not try drive a truck, when I dont know how to drive a car.
Maxdd 7 wrote:
I just no apply them for now, because I believe I should not try drive a truck, when I dont know how to drive a car.
Your problem is that you choose to drive the truck instead of starting with the damn car.
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.
-
I know you are right I'm just trying to make you understand my point of view. Until some days ago, I never coded a line of C# and used ASP.NET controls. I dont have a book (or e-book) or anyone I know who could teach me. The few I learn, was throught google, and even by google it could be difficult find the information I need. There are so many things of ASP.NET (I never imagined!), and then exists .NET 1.1, 2.0, 3.0 (...) VB.NET, older versions, near versions (...) Sometimes it could be difficult start coding in this conditions, because I dont know where to stand, where to look. But ok, from now on, I will try to follow your advices, and just post questions (if necessary) about it. My apologies for any incovenience.
Maxdd 7 wrote:
Until some days ago, I never coded a line of C# and used ASP.NET controls.
Which means you're an idiot for trying ASP.NET at all. You need good C# first.
Maxdd 7 wrote:
I dont have a book
If you can't buy one, then at least recognise what the right sequence is. I taught myself and I started with C++, then learned MFC. No-one told me that, it was common sense.
Maxdd 7 wrote:
. The few I learn, was throught google, and even by google it could be difficult find the information I need.
99% of the questions asked here, it's trivial to get answers with google. The problem is you're trying to ask complex questions, before knowing the answers to the easy ones.
Maxdd 7 wrote:
There are so many things of ASP.NET (I never imagined!), and then exists .NET 1.1, 2.0, 3.0 (...) VB.NET, older versions, near versions (...) Sometimes it could be difficult start coding in this conditions, because I dont know where to stand, where to look.
C#. Ignore VB.NET. Learn basic C#, preferably writing console apps. Then you could progress to web pages, perhaps. Don't even try to learn SQL before you know C# really well. Don't even think of ASP.NET before you learn the language that drives it.
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.