i keep on getting this error message incorrect syntax in line1... funny thing is when i execute every thing from SQL Query analyzer it works just fine but when i am executing the stored procedure from .net i keep on getting the errro message that i have mentioned above..
my sql stored procedure code snippet is as follows
CREaTE PROCEDURE dbo.OracleStudentTbl
@tblName as varchar(255)
DECLaRE @SQL as varchar(8000)
DECLaRE @tbl as varchar(255)
SET @tbl =@tblName
'INSERT INTO [dbo].['+@tbl+']'
SELECT * FROM OPENQUERY(XXXX 'SELECT * FROM vw_student_details_forsurvey')
basically what my stored procedure is doing is fetching a table name from my vb.net windows form then passing it to the stored procedure, then my SELECT * FROM OPENQUERY is populating the the table with its information... but as i mentioned i receive the syntax error...my code in my command button on vb.net is as follows
Private Sub butSave_Click(ByVal sender as System.Object, ByVal e as System.Eventargs) Handles butSave.Click
Dim varDetails As String = txtDetails.Text + "_" + txtDetailsTblName.Text
Dim sqlCommandDetailsInsert As New SqlCommand("OracleStudentTbl", connStr)
sqlCommandDetailsInsert.CommandType = CommandType.StoredProcedure
'this command is sending to the stored procedure the table name for the Students Details Table so that
'student details table will be populated with the data from the Oracle See
sqlCommandDetailsInsert.ExecuteNonQuery() ' receive error here when I'm debbuging my windows forms
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Info, "ErrorIn Code")
Dim frmMain As New frmMain
frmMain.mySQLname = var
would applaud assist pls..