Double click the command button. This will open up the code view and add the event handler for the button's click event. To make some of the coding more efficient, add a constant at the top to hold the connection string. This assumes the SQL Server is the local machine and has been set up with the current user as a valid user of the server and uses Windows Authentication. Naturaly you should adjust the ConnectionString to fit your needs.
what the **** does that mean? Whats a constant? and what does holding the connection string mean?
First thing we'll do is to add some code to retrieve a list of Products from the database. The steps to do this are straightforward: create a connection, a select command, a data adapter that uses the connection and command, and lastly, fill the DataSet with the data.
First create the connection:
code:
VB Code:
Dim DBConnection As New SqlClient.SqlConnection(MyCONNECTIONSTRING)
What does MyCONNECTIONSTRING signify, is that something i have to create, like a string of my own code, or what?
Um, in the tutorial MyCONNECTIONSTRING was declared in the previous code box about 2 centimetres above the code you just quoted. It's the constant you were asking about in your previous post. It really sounds to me like you need to get back to basics and improve your grounding in VB.NET before tackling data access. Constants are a pretty basic part of any programming langauge. Variables store a value that varies, while constants store a value that is constant.
Um, in the tutorial MyCONNECTIONSTRING was declared in the previous code box about 2 centimetres above the code you just quoted. It's the constant you were asking about in your previous post. It really sounds to me like you need to get back to basics and improve your grounding in VB.NET before tackling data access. Constants are a pretty basic part of any programming langauge. Variables store a value that varies, while constants store a value that is constant.
I have roughly been using VB for about 1 1/2 weeks.
I dont know jack sh*t, im just trying to pick it up as i go, by following tutorials, listening to what people say, and gettin people to explain in every detail, what the things do, and how they do it.
Click on my nickname, and read my profile. That will give you a better idea of what im up against.
You guys are helping heaps, but i just need to cram as much information in my brain as i can.
There's not much point cramming information in one side if more is falling out the other and a good part of the rest is spilling out befroe it gets in. The fact that you missed the declaration of MyCONNECTIONSTRING proves that you're not absorbing what you're reading, so I'd suggest that you slow down and concentrate on quality rather than quantity. If you don't know what a connection string is then the code you posted in your previous thread was obviously not your own, so you're asking how to delete data before you even really know how to retrieve it. Have you heard an expression about walking and running?
There's not much point cramming information in one side if more is falling out the other and a good part of the rest is spilling out befroe it gets in. The fact that you missed the declaration of MyCONNECTIONSTRING proves that you're not absorbing what you're reading, so I'd suggest that you slow down and concentrate on quality rather than quantity. If you don't know what a connection string is then the code you posted in your previous thread was obviously not your own, so you're asking how to delete data before you even really know how to retrieve it. Have you heard an expression about walking and running?
yeh i get ya, no need to point ou what i already know, i asked about Deleting a row in an ACCESS database that i was using, but you directed me along to something more difficult.
i obviously dont know how to write code from scratch, cos i dont have an undertanding of everything atm. But i have learnt more trying to put together a mock program, with a database, than i have sitting and watching video tutorials, or just reading stuff.
Hands on, trying to figure stuff out, is how im remebering things and learning along the way, i have no one to ask questions to, apart from people on forums and people on forums treat everyone like they are already experts.
So i just have to kind of make due.
believe me the help you are giving me is definatly worth while, i just need some guidance.