|
-
Sep 20th, 2015, 08:38 AM
#1
Thread Starter
Enjoy the moment
[RESOLVED] is there a way to create a new field in an existing table that has password protecte?
i have a db called HairDesign and it is protected with a password of 123456
now in this DB i have a table called BackArc
is there a wat to create with vb another field?
HairDesign.zip
PassWord is 123456
tnx in advanced
salsa31
-
Sep 20th, 2015, 09:10 AM
#2
Re: is there a way to create a new field in an existing table that has password prote
Use the Alter Table method:
Code:
Alter table [table name]
Add column [column name] [column type] [null|not null]
just execute it like any other SQL statement against the database.
-tg
-
Sep 20th, 2015, 09:15 AM
#3
Thread Starter
Enjoy the moment
Re: is there a way to create a new field in an existing table that has password prote
Hey
tg
just execute it like any other SQL statement against the database.
can you give me a Start or something?
do i need to Dim SomeThing?
-
Sep 20th, 2015, 09:17 AM
#4
Re: is there a way to create a new field in an existing table that has password prote
It's jsut a SQL statement. Nothing more. Nothing less. I KNOW you know how to execute SQL statements, you've got plenty of posts were that's been discussed. There's nothing special about it except it will not return a recordset.
-tg
-
Sep 20th, 2015, 09:21 AM
#5
Thread Starter
Enjoy the moment
Re: is there a way to create a new field in an existing table that has password prote
Alter table [table name]
Add column [column name] [column type] [null|not null]
sry sir never done this before
BTW the DB has a password 123456
this is the SQL i know
Code:
StrSql = "Update PriceList set PriceStartTime ='0', PriceEndTime ='0'"
CN.Execute StrSql
-
Sep 20th, 2015, 09:21 AM
#6
Re: is there a way to create a new field in an existing table that has password prote
If this is a Jet 4.0 (Jet OLEDB:Engine Type=5, a.k.a. "Access 2000/2002/2003 format") database then there are two types of "passwords."
One is the simple caveman "database password" for share-level security and the other is a "user password" that varies by user when you are using proper Jet user & group role-based security.
If you are using share-based security then it is merely a matter of supplying that password when you connect. The Connection Property is named "Jet OLEDB:Database Password" and you can set this in the connection string or separately via the Connection.Properties collection.
The same is true for role-based security, but you have two properties "User ID" and "Password" to set.
Once you have a connection opened with sufficient permissions you can add a column/field to the table either via ADOX or via Jet SQL DDL commands.
-
Sep 20th, 2015, 09:23 AM
#7
Thread Starter
Enjoy the moment
Re: is there a way to create a new field in an existing table that has password prote
hey sir this is what i use
Code:
Public Sub DataBaseConnectionSystem()
On Error GoTo ErrMsg
Set CN = New ADODB.Connection
StrSql = "Provider=Microsoft.Jet.OLEDB.4.0;"
StrSql = StrSql & "Data Source=" & App.Path & "\HairDesign.mdb;"
StrSql = StrSql & "Jet OLEDB:Database Password=123456"
CN.ConnectionString = StrSql
CN.Open
ErrMsg:
End If
-
Sep 20th, 2015, 05:24 PM
#8
Re: is there a way to create a new field in an existing table that has password prote
You've already opened your database....simply do what tg said in post #2....simple.
-
Sep 20th, 2015, 10:12 PM
#9
Thread Starter
Enjoy the moment
Re: is there a way to create a new field in an existing table that has password prote
hey sami i dont know what to do sry
-
Sep 21st, 2015, 05:45 AM
#10
Re: is there a way to create a new field in an existing table that has password prote
Why do you always insist on making this harder than it needs to be? I know you know how to execute a SQL statement. The forums are littered with your posts regarding SQL commands... This is no different. A SQL statement is a SQL statement... you create a command object, set the command text on it, then execute it... plain and simple. There's no magic to it.
And with that I'm done with this thread.
-tg
-
Sep 21st, 2015, 07:51 AM
#11
Re: is there a way to create a new field in an existing table that has password prote
Instead of just giving you the code, please look at this tutorial...it tells you EXACTLY how do to what you want to do.
http://www.vb6.us/tutorials/access-sql
Sammi
-
Sep 21st, 2015, 07:54 AM
#12
Thread Starter
Enjoy the moment
Re: is there a way to create a new field in an existing table that has password prote
Why do you always insist on making this harder than it needs to be? I know you know how to execute a SQL statement
i know yes but this is diffrent
Instead of just giving you the code, please look at this tutorial...it tells you EXACTLY how do to what you want to do.
i just want a starter thats it
-
Sep 21st, 2015, 07:56 AM
#13
Thread Starter
Enjoy the moment
Re: is there a way to create a new field in an existing table that has password prote
Alter table [table name]
Add column [column name] [column type] [null|not null]
what is this?
alter table?
i dont understand Tg i am not playing around
just asking how to do this thats all why is it so hard to help me?
-
Sep 21st, 2015, 08:36 AM
#14
Re: is there a way to create a new field in an existing table that has password prote
Alter table is one of many sql statements that can be used
What you have been shown is clear and simple and while you may not have did this exact thing before it is the same as what you have done 1000 times only the text on the sql statement is different.
Code:
CN.Execute SQLStatement
Alter means to change
All you have to do is plug in the proper values for you table name, column name and such then execute it just like if it was an update query
-
Sep 21st, 2015, 09:25 AM
#15
Thread Starter
Enjoy the moment
Re: is there a way to create a new field in an existing table that has password prote
All you have to do is plug in the proper values for you table name, column name and such then execute it just like if it was an update query
you mean like this sir?
Code:
Dim StrSql As String
StrSql = "Update Alter table [BackArc] Add [Remarks] [Memo]"
CN.Execute StrSql
-
Sep 21st, 2015, 09:52 AM
#16
Re: is there a way to create a new field in an existing table that has password prote
Yes and no. Yes you use execute as you have been told a few times already. No you do not add update into the query.
You added Update into the query and that does not go there.
You were shown what the sql statement should look like and there was no Update any where in any of that.
I said you execute just like you would an update query not that you should add update into it.
To execute any query you use execute, It doesn't matter it it is a drop statement, an alter statement or the ones you are more used to like update, delete, insert. They are all sql statements and they are all executed the same way the only thing that is different is the actual text of the statement.
-
Sep 21st, 2015, 11:19 AM
#17
Thread Starter
Enjoy the moment
Re: is there a way to create a new field in an existing table that has password prote
Code:
CN.Execute = "Alter table [BackArc] Add [Remarks] [Memo]"
forget it sir i dont understand i just dont
-
Sep 21st, 2015, 11:33 AM
#18
Re: is there a way to create a new field in an existing table that has password prote
you were so close with:
Code:
Dim StrSql As String
StrSql = "Update Alter table [BackArc] Add [Remarks] [Memo]"
CN.Execute StrSql
Now, look at this EXAMPLE (IN THE LINK I SHOWED YOU IN #11):
Code:
StrSql = "ALTER TABLE Customers ADD COLUMN CustName TEXT 25
can you take it from here? (Wish you had studied that tutorial!)
-
Sep 21st, 2015, 01:18 PM
#19
Re: is there a way to create a new field in an existing table that has password prote
Make it short.
After defining the password in your 'CN' connection string Database Password=123456
Build your query:
Code:
StrSql = "Alter Table [BackArc] Add Column [Field1] Text"
Execute it:
Done.
More fun to read information on table altering can be found here: http://www.w3schools.com/sql/sql_alter.asp
-
Sep 21st, 2015, 01:27 PM
#20
Thread Starter
Enjoy the moment
Re: is there a way to create a new field in an existing table that has password prote
hey stum what about the Db HairDesign?
i dont see it in the query
only the table
-
Sep 21st, 2015, 01:44 PM
#21
Thread Starter
Enjoy the moment
Re: is there a way to create a new field in an existing table that has password prote
Code:
StrSql = "Alter Table BackArc Add Column Field1 Memo"
CN.Execute StrSql
tnx for your help amigos
-
Sep 21st, 2015, 02:03 PM
#22
Re: [RESOLVED] is there a way to create a new field in an existing table that has pas
Why would you name a field, "Field1"? Because it is a Memo field, maybe something like "Remarks" would be more suitable.
Too bad stum showed you....was hoping you'd get the answer from the link (post#11)...you learn more by researching than simply taking others' code...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|