SAVE DATA program in VB.NET
-
Please any body who might give an opinion about my Save Data ..!
MsgBox("Is Data Correctly Right ?", MsgBoxStyle.YesNo, "Confirmation") If MsgBoxResult.Yes Then drcustoms = dtcustoms.NewRow drcustoms("cstcd") = txtcstcd.text drcustoms("cstnm") = txtcstnm.text drcustoms("cstadrs") = txtcstadrs.text drcustoms("cstphno") = txtcstphno.text conn.Open endif
the procedure is after the message box appear and the answer is "Yes" the field should save in the database, if the answer is "No" abort the save. I'am the new bies and interesting in VB.NET programming. Please give an opnion if any body know the right and the simple code program. Best Regards, Ahmad Rifai Yusuf -
Please any body who might give an opinion about my Save Data ..!
MsgBox("Is Data Correctly Right ?", MsgBoxStyle.YesNo, "Confirmation") If MsgBoxResult.Yes Then drcustoms = dtcustoms.NewRow drcustoms("cstcd") = txtcstcd.text drcustoms("cstnm") = txtcstnm.text drcustoms("cstadrs") = txtcstadrs.text drcustoms("cstphno") = txtcstphno.text conn.Open endif
the procedure is after the message box appear and the answer is "Yes" the field should save in the database, if the answer is "No" abort the save. I'am the new bies and interesting in VB.NET programming. Please give an opnion if any body know the right and the simple code program. Best Regards, Ahmad Rifai YusufWithout seeing the rest of your code, like what's
drcustoms
,dtcustoms
, and what the rest of thatconn
object looks like, it's very difficult to tell you what your doing wrong. I can tell your that you set the values of a bunch of fields, then opened a connection to a database, but you DIDN'T execute any proecure to write that information to the database, nor did you close the connection to it. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome -
Please any body who might give an opinion about my Save Data ..!
MsgBox("Is Data Correctly Right ?", MsgBoxStyle.YesNo, "Confirmation") If MsgBoxResult.Yes Then drcustoms = dtcustoms.NewRow drcustoms("cstcd") = txtcstcd.text drcustoms("cstnm") = txtcstnm.text drcustoms("cstadrs") = txtcstadrs.text drcustoms("cstphno") = txtcstphno.text conn.Open endif
the procedure is after the message box appear and the answer is "Yes" the field should save in the database, if the answer is "No" abort the save. I'am the new bies and interesting in VB.NET programming. Please give an opnion if any body know the right and the simple code program. Best Regards, Ahmad Rifai YusufFirst of all, try something like "Is the data correct?". secondly, you will need to add drcustoms("cstphno") = txtcstphno.text --> dtcustoms.rows.add(drcustoms) finally, this will just be storing the data in a disconnected datatable. To send the data back to the database, you will need to a)create a database command, build a sql string (or preferably use a stored procedure) execute the command or b) use the Update method of a dataAdapter Visit my .Net blog at http://hiltong.blogspot.com