G
Guest
I have wrote this code and my DB server is Sql Server 2000 SP4
Dim cnSql as new SqlClient.SqlConnection
Dim cmdSql As New SqlClient.SqlCommand
cnsql="Data Source=ced2; User ID=sa; Password=;Initial Catalog=NGN;Persist
Security Info=True;"
cnsql.open
cmdSql.CommandText = "create view VISTAGIACENZE as select
codice,sum(giacenza) as Giacenza from giacenze where magazzino='001' or
magazzino='500' group by codice"
cmsql.connection=cnsql
cmdSql.CommandText = strsql
cmdSql.ExecuteNonQuery()
When I try to execute method executenonquery Visual Studio return this error
System.Data.SqlClient.SqlException - Incorrect syntax near the keyword
'VIEW'.
It's very strange because executing the same string in query analyzer works
fine without errors.
Could you help me???
Thanks in advance.
Antonio.
Dim cnSql as new SqlClient.SqlConnection
Dim cmdSql As New SqlClient.SqlCommand
cnsql="Data Source=ced2; User ID=sa; Password=;Initial Catalog=NGN;Persist
Security Info=True;"
cnsql.open
cmdSql.CommandText = "create view VISTAGIACENZE as select
codice,sum(giacenza) as Giacenza from giacenze where magazzino='001' or
magazzino='500' group by codice"
cmsql.connection=cnsql
cmdSql.CommandText = strsql
cmdSql.ExecuteNonQuery()
When I try to execute method executenonquery Visual Studio return this error
System.Data.SqlClient.SqlException - Incorrect syntax near the keyword
'VIEW'.
It's very strange because executing the same string in query analyzer works
fine without errors.
Could you help me???
Thanks in advance.
Antonio.