如何在文本框中用两个单词命名表 [英] How to name the table with two words in textbox
本文介绍了如何在文本框中用两个单词命名表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好的我有问题
这种sql命令我有问题当我在textBox中输入两个单词,当我只有一个单词他正在创建表格时,他在第二个单词附近给出了错误的错误语法
我尝试了什么:
SqlCommand comand = new SqlCommand(< span class =code-string> CREATE TABLE Dobavljaci _ + textBox.Text + (ID int NOT NULL identity(1,1)主键,Naziv varchar(50),Sjediste varchar(50),Adresa varchar(50),Ziroracun varchar(50),sifra varchar(50),JIB varchar(50),Ulaz money,Izlaz money);,CON);
你可以帮我吗
解决方案
在包含空格的名称周围添加[](方括号)。
例如
CREATE TABLE [Dobavljaci_+ textBox.Text +](ID int NOT NULL。 .....
Ok i have problem
on this kind of sql command i have problem when i enter two word in textBox he is giving me error incorrect syntax near the second word when i have only one word he is creating the tables
What I have tried:
SqlCommand comand = new SqlCommand("CREATE TABLE Dobavljaci_" +textBox.Text+ "(ID int NOT NULL identity(1,1) primary key,Naziv varchar(50),Sjediste varchar(50),Adresa varchar (50),Ziroracun varchar (50),sifra varchar(50),JIB varchar(50),Ulaz money,Izlaz money);", CON);
Can you help me please
解决方案
Add [ ] (square brackets) around the name that has the space in it.
eg
CREATE TABLE [Dobavljaci_" +textBox.Text+ "](ID int NOT NULL ......
这篇关于如何在文本框中用两个单词命名表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文