:lol: need help!!!
how can i change the value of an item of (Yes/No) datatype in a DB Using VB.NET??
assume that the column is named (a)
If you use the ADO.Net in your application you can use the the DBCommand object to update your database. The DBCommand object
has a property named CommandText that can be used to set the SQL command to be executed.
i wrote this code, but it give me an error i do not know where s the error
S_Status .... the column name
it can take values (Yes/No)
i am using MS Access DB
:rolleyes: can you help me with it plz
I think you get it wrong with the Insert method here. The Insert method here is from the String class and is for you to insert a string at a give position in the string instance. So it will not actually insert anything to your database but instead, insert a string to the CommandText property which expect a SQL command string . For you to insert a value to a YES/NO to your db column, you can use the following...
This assumed you have defined and initialised the connection and command object.
Me.OleDbDataAdapter1.SelectCommand.CommandText="INSERT INTO YourTableName(S_Status) Values(1)"
Note : Put 1 if you want to set the value to YES and 0 if it is a NO
Hope this will help
i try it
Me.OleDbDataAdapter1.SelectCommand.CommandText = "INSERT INTO StaffAccount(S_Status) values(1)"
but i think there is something missing
* the problem is.... i have a login form if a staff login to the system his status should changed... and when we show the second form his name will be written in the list of Online staff
is the problem understandable? :?:
I am not sure, but i think you need to add the rest of the commands to complete the commandset of the oledbadapter.
the way i do it, i create an adodb.connection and then set the value of that field to a boolean varible = true.
Hope it helps
sorry for my late reply.
The code provided is a code snippet only. You have to have the connection and command object declared and instantiated first before action can be perform to write to the Access database via the SQL command. If you still need to get help, please send me an email or private message. I will provide you a full source code of reading and setting the user login status.
We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.