Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Answers
Parametize ALTER TABLE ??? Help!
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
zsing
15y
2.8k
1
Reply
I want to modify a table's structure with a method.
Please help how to write this method!
I've tried:
public void tableExpand(string tableName, string colName)
{
...................
dataCommand.CommandText =
"ALTER TABLE @tableName" +
"ADD @colName real";
SqlParameter tableParam = new SqlParameter();
tableParam
.ParameterName = "@tableName";
tableParam
.Value = tableName;
SqlParameter colParam = new SqlParameter();
colParam
.ParameterName = "@colName";
colParam
.Value = colName;
dataCommand.Parameters.Add(tableParam);
dataCommand.Parameters.Add(colParam);
.....................
}
But this isn't the right way :(
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
How to load an XML file in C#.Net (by ignoring ':' )
I am giving font style ="123" but it is taking "Microsoft sans serif". How can I change that to some other