Click here to Skip to main content
15,888,984 members
Home / Discussions / C#
   

C#

 
Questionspeech recognition in C# Pin
Member 1178520026-Aug-15 7:28
Member 1178520026-Aug-15 7:28 
AnswerRe: speech recognition in C# Pin
Richard MacCutchan26-Aug-15 22:14
mveRichard MacCutchan26-Aug-15 22:14 
JokeRe: speech recognition in C# Pin
Pete O'Hanlon27-Aug-15 4:21
mvePete O'Hanlon27-Aug-15 4:21 
GeneralRe: speech recognition in C# Pin
Richard MacCutchan27-Aug-15 4:47
mveRichard MacCutchan27-Aug-15 4:47 
QuestionMicrosoft.Speech AppendDictation Pin
Member 1192461826-Aug-15 1:07
Member 1192461826-Aug-15 1:07 
QuestionConnect to Report server using a C# service. Pin
Member 328413825-Aug-15 21:38
Member 328413825-Aug-15 21:38 
AnswerRe: Connect to Report server using a C# service. Pin
Herman<T>.Instance25-Aug-15 21:50
Herman<T>.Instance25-Aug-15 21:50 
QuestionExec within an sqlstament for Excecutenonquery Pin
pschulz25-Aug-15 18:20
pschulz25-Aug-15 18:20 
Hello,

I want to create a table, grant previlegs, create a stored procedure and finally use this stored procedure.
And I want to use all of them with 'exec'.

A good explication to use exec within an sqlstament ist here,
https://stackoverflow.com/questions/3523989/how-to-use-sqlcommand-to-create-database-with-parameterized-db-name

But no matter what I'm doing I cant run finally the stored-procedure.
It says allways, it couldnt find the store procedure.
Or, if I try it without exec, than it says it has to much arguments.

It works only if I use all the other staments without exec.

This is how it looks, for grant and create stp as well
C#
public void CreateTable(string strtblName)
       {
           strSQL = "EXEC ('CREATE TABLE ' + @tblName + ([EmployeeID] [int] NOT NULL PRIMARY KEY CLUSTERED," +
                  "[VorName] [nvarchar](50) NULL, [NachName] [nvarchar](50) NULL," +
                  " [Titel] [nvarchar](30) NULL," + " [City] [nvarchar](50) NULL," +
                  " [BirthDate] [date] NULL) ON [PRIMARY]')";


           try
           {

               myCnn.Open();
               myCmd.Connection = myCnn;
               myCmd.CommandType = CommandType.Text;
               myCmd.CommandText = strSQL;

               myCmd.Parameters.Clear();
               myCmd.Parameters.Add("@tblName", SqlDbType.Text);
               myCmd.Parameters["@tblName"].Value = strtblName;

               myCmd.ExecuteNonQuery();
               myCnn.Close();

           }
           catch (Exception ex)
           {
               myCnn.Close();
               throw new Exception(ex.Message);
           }

       }

AnswerRe: Exec within an sqlstament for Excecutenonquery Pin
Wendelius25-Aug-15 18:26
mentorWendelius25-Aug-15 18:26 
SuggestionRe: Exec within an sqlstament for Excecutenonquery Pin
Richard Deeming26-Aug-15 2:11
mveRichard Deeming26-Aug-15 2:11 
GeneralRe: Exec within an sqlstament for Excecutenonquery Pin
Wendelius26-Aug-15 2:42
mentorWendelius26-Aug-15 2:42 
AnswerRe: Exec within an sqlstament for Excecutenonquery Pin
Richard Deeming26-Aug-15 2:16
mveRichard Deeming26-Aug-15 2:16 
AnswerRe: Exec within an sqlstament for Excecutenonquery Pin
pschulz28-Aug-15 17:39
pschulz28-Aug-15 17:39 
AnswerRe: Exec within an sqlstament for Excecutenonquery Pin
ebk213-Sep-15 13:00
ebk213-Sep-15 13:00 
QuestionHow to achieve WPF window designer? Pin
Member 1193585525-Aug-15 17:51
Member 1193585525-Aug-15 17:51 
AnswerRe: How to achieve WPF window designer? Pin
Pete O'Hanlon25-Aug-15 21:05
mvePete O'Hanlon25-Aug-15 21:05 
QuestionWeb-Api in Mvc5.net Pin
Member 1190393725-Aug-15 4:51
Member 1190393725-Aug-15 4:51 
AnswerRe: Web-Api in Mvc5.net Pin
Dave Kreskowiak25-Aug-15 5:24
mveDave Kreskowiak25-Aug-15 5:24 
Questionuse ready made form in another form Pin
mattlas24-Aug-15 22:46
mattlas24-Aug-15 22:46 
AnswerRe: use ready made form in another form Pin
OriginalGriff24-Aug-15 22:56
mveOriginalGriff24-Aug-15 22:56 
GeneralRe: use ready made form in another form Pin
mattlas24-Aug-15 23:43
mattlas24-Aug-15 23:43 
GeneralRe: use ready made form in another form Pin
OriginalGriff24-Aug-15 23:48
mveOriginalGriff24-Aug-15 23:48 
GeneralRe: use ready made form in another form Pin
mattlas25-Aug-15 0:51
mattlas25-Aug-15 0:51 
GeneralRe: use ready made form in another form Pin
OriginalGriff25-Aug-15 1:04
mveOriginalGriff25-Aug-15 1:04 
GeneralRe: use ready made form in another form Pin
Dave Kreskowiak25-Aug-15 1:30
mveDave Kreskowiak25-Aug-15 1:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.