How can I update a database MSSQL 2005 Express record using the ID field and using VBScript?
I have a script in VBScript:
myCommand.CommandText = "UPDATE Klienci_NC SET Klienci_NC.Klient = '" & & Klient_niceform' 'WHERE Klienci_NC.ID =' "& ID_zmienna &" '"
But to update the record in the Klienci_NC.Klient in MSSQL database Klienci_NC I have to type in the box ID_zmienna given number representing the record ID column.
What to do variable it is automatically downloaded to the box?
All my VBScipt script looks like this:
Dim conn, SQL, rs
Const DB_CONNECT_STRING = "Provider=SQLOLEDB.1;Data Source=DJ-PC;Initial Catalog=Baza_NC;user id ='user_baza_nc';password='password'"
Set myConn = CreateObject("ADODB.Connection")
Set myCommand = CreateObject("ADODB.Command" )
myConn.Open DB_CONNECT_STRING
Set myCommand.ActiveConnection = myConn
rem myCommand.CommandText = "UPDATE Klienci_NC SET Klienci_NC.Klient = 'Hello'"
rem myCommand.CommandText = "UPDATE Klienci_NC SET Klienci_NC.Klient = '" & Klient_niceform & "'"
myCommand.CommandText = "UPDATE Klienci_NC SET Klienci_NC.Klient = '" & Klient_niceform & "' WHERE Klienci_NC.ID = '" & ID_zmienna & "'"
myCommand.Execute
myConn.Close
What to do to update the selected record in the database, and not all?
Aucun commentaire:
Enregistrer un commentaire