I am trying to create a c# statement which creates a table.
Below is my current query:
string user = (User.Identity.Name);
string db = user+["-Result"] + DateTime.Now.ToString("yyyyMMddHHmmss");
I am trying to create a table of name which will be something like Jane-Result2011111111
I am able to create the table when my statement did not include the name :
user+"Result" + DateTime.Now.ToString("yyyyMMddHHmmss");
May I know how can I include the - in my statement?
Thank you
Edit
Ok, you re-tagged and edited your question after my first answer. Try moving the brackets inside of the quotes (or remove them all together).
string db = user + "[-Result]" + DateTime.Now.ToString("yyyyMMddHHmmss");There are better ways in C# to combine strings though. One is
String.Format.Original answer
Not sure what language the code is in (C#?), but I’m guessing you need a
+between your 2nd double quote and the word user.string db = "'%" + user + "%'Result" + DateTime.Now.ToString("yyyyMMddHHmmss");