If you want to get a number of values you should use a table adapter and use a select query to fill that.
the "Where" part allows you to separate the list based on any criteria you see fit. For example - and assuming there is a table called table having column called age:
Select * from people where age>30
will get you all people those age greater than 30.
what do you mean by action here...? I assume in this case that you want to store the "Action" value in the database. So the value of the column "Next action" get transferred to "previous action" for the same given row, You could use a simple query, its sql should be:
update yourtablename set PreviousAction=NextAction, NextAction=@YourNewNextAction where YourRowID=@rowid
Dude you are giving me too much credit. I am not that good, and at some point my skills were similar to yours. With practice you could get better and better.
@MrAshiid Which statement is giving you the error? The error states that you are accessing an array, or collection , or list - of rows for example - and supplying the wrong index. For example you could get this error from this code:
Dim A As New Collection
A.Add("hi")
MsgBox A(0)
the reason for the error here is that a Collection index starts from 1 not zero, but:
Dim A As New List(Of String)
A.Add("hi")
MsgBox A(0) ' works
MsgBox A(1) ' gives error because lists start from 0
Great Job on the videos, you go into more depth then most!! I have one issue how do i make the program so that i can switch database and SQL servers? I know how to build the connection string and i have a preferences form to switch the connections but then i cant use the "wizards" to build the datasets. I would be happy to give you what i have for code so far.
if your databases are exactly the same structure, then you create a dataset for your db, and then at runtime, you just change the connection string. You could change application's settings at runtime to address this issue.
if you include the database in your project make sure that you are opening the database that is in the debug / bin folder not the other one. The original db is not affected.
How can i select list of people and seperate them ?
Dartheppa 2 months ago
@Dartheppa
If you want to get a number of values you should use a table adapter and use a select query to fill that.
the "Where" part allows you to separate the list based on any criteria you see fit. For example - and assuming there is a table called table having column called age:
Select * from people where age>30
will get you all people those age greater than 30.
mkaatr 1 month ago
@mkaatr (bow) thank you :)
if its not too much could u help me out again.
im making a Db application for kicks and im stuck .
i want to make my next action to be the previous action when i update my next action automaticaly
Dartheppa 1 month ago
@Dartheppa
Hi there...
what do you mean by action here...? I assume in this case that you want to store the "Action" value in the database. So the value of the column "Next action" get transferred to "previous action" for the same given row, You could use a simple query, its sql should be:
update yourtablename set PreviousAction=NextAction, NextAction=@YourNewNextAction where YourRowID=@rowid
hope this helps :)
mkaatr 1 month ago
@mkaatr u are god and i am ur humble follower (bow) , cant believe i forgot about UPDATE :(
thankyou :)
Dartheppa 1 month ago
@Dartheppa
Dude you are giving me too much credit. I am not that good, and at some point my skills were similar to yours. With practice you could get better and better.
cheers :)
mkaatr 1 month ago
@mkaatr have to give credit where credit is due. :)
i appreciate the help
thank you
Dartheppa 1 month ago
i get these error can someone help Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
MrAshiid 2 months ago
@MrAshiid Which statement is giving you the error? The error states that you are accessing an array, or collection , or list - of rows for example - and supplying the wrong index. For example you could get this error from this code:
Dim A As New Collection
A.Add("hi")
MsgBox A(0)
the reason for the error here is that a Collection index starts from 1 not zero, but:
Dim A As New List(Of String)
A.Add("hi")
MsgBox A(0) ' works
MsgBox A(1) ' gives error because lists start from 0
mkaatr 2 months ago
@mkaatr it's the delete statement
MrAshiid 2 months ago
@MrAshiid
A delete statement shouldn't trigger such error. Could you paste the whole block of code so that I get an idea where the error is?
Also did you try to trace the code and see exactly where the error is happening?
mkaatr 2 months ago
Great Job on the videos, you go into more depth then most!! I have one issue how do i make the program so that i can switch database and SQL servers? I know how to build the connection string and i have a preferences form to switch the connections but then i cant use the "wizards" to build the datasets. I would be happy to give you what i have for code so far.
redsoxyeargmail 3 months ago
@redsoxyeargmail
Hi there...
if your databases are exactly the same structure, then you create a dataset for your db, and then at runtime, you just change the connection string. You could change application's settings at runtime to address this issue.
yours
mkaatr 3 months ago
can you show me how to make update in addition with that project. thanks in advance.
royalopez06 8 months ago
@royalopez06
hi there...
use the sql update statement: update people set pname=@0,name=@1,address=@2 where pname=@3
the rest of the steps is the same.
by the way, you could use the table adapter to do the same. It might be easier, and you don't have to create a query.
yours
mkaatr 8 months ago
I followed your video, and it works fine, but if I close it and actually open the access database it isn't updated. Whats the problem?
Greenmet29 9 months ago
@Greenmet29
Hi there...
if you include the database in your project make sure that you are opening the database that is in the debug / bin folder not the other one. The original db is not affected.
yours
mkaatr 9 months ago
hi how did you add that addperson. i got error in QA.addperson
uboomn 1 year ago
@uboomn
Hi there...
Check the link provided in the description. You can see step by step what I did. If you still having problems let me know.
yours.
mkaatr 1 year ago
I didn't know about the query adapter - good video, thanks!
SentinelX1 1 year ago