-
Incorrect syntax near...
Okay i am growing weary of staring. I keep getting incorrect syntax near 'usp_bldgs_c' I cannot figure out what that is. Please help!
Code:
Private Sub AddNewRecord(ByVal bldgdesc As String)
Dim conString As String = Utilities.GetConnectionString("AssetInventory")
Dim conInventory As SqlConnection = New SqlConnection(conString)
Dim cmdStoredProc As SqlCommand
cmdStoredProc = New SqlCommand("usp_bldgs_c", conInventory)
cmdStoredProc.Parameters.AddWithValue("@bldg_desc", bldgdesc)
conInventory.Open()
cmdStoredProc.ExecuteNonQuery()
conInventory.Close()
BindBldg(bldgdesc)
End Sub 'AddNewRecord
-
Try setting cmdStoredProc's .CommandType property to CommandType.StoredProcedure.
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
-
Yaa try to put
Code:
cmdStoredProc.CommandType = CommandType.StoredProcedure
cmdStoredProc.CommandText = "usp_bldgs_c"
cmdStoredProc.Parameters.Add(New SqlParameter("@bldg_desc", bldgdesc))
try to do like this....
-
I did this and it worked wonderfully, however now I am doing the UpdateRecord and it's saying the same thing
Code:
Private Sub UpdateRecord(ByVal bldgid As Integer, ByVal bldgdesc As String)
Dim conString As String = Utilities.GetConnectionString("AssetInventory")
Dim conInventory As SqlConnection = New SqlConnection(conString)
Dim cmdStoredProc As SqlCommand
cmdStoredProc = New SqlCommand("usp_bldgs_u", conInventory)
cmdStoredProc.CommandType = CommandType.StoredProcedure
cmdStoredProc.Parameters.AddWithValue("@bldg_id", bldgid)
cmdStoredProc.Parameters.AddWithValue("@bldg_desc", bldgdesc)
conInventory.Open()
cmdStoredProc.ExecuteNonQuery()
conInventory.Close()
BindBldg()
-
Code:
Private Sub UpdateRecord(ByVal bldgid As Integer, ByVal bldgdesc As String)
Dim conString As String = Utilities.GetConnectionString("AssetInventory")
Dim conInventory As SqlConnection = New SqlConnection(conString)
Dim cmdStoredProc As new SqlCommand
cmdStoredProc.CommandType = CommandType.StoredProcedure
cmdStoredProc.CommandText = "usp_bldgs_c"
cmdStoredProc.Parameters.AddWithValue("@bldg_id", bldgid)
cmdStoredProc.Parameters.AddWithValue("@bldg_desc", bldgdesc)
conInventory.Open()
cmdStoredProc.ExecuteNonQuery()
conInventory.Close()
BindBldg()
try like this..may the order was wrong...
u declared this
cmdStoredProc.CommandType = CommandType.StoredProcedure
after the passing the name of the SP.
Similar Threads
-
By yasinirshad in forum Database
Replies: 3
Last Post: 08-14-2007, 08:55 AM
-
By Matrix.net in forum Database
Replies: 0
Last Post: 03-28-2007, 10:36 AM
-
By kenn_rosie in forum .NET
Replies: 5
Last Post: 04-09-2006, 08:28 PM
-
By Daryl in forum Database
Replies: 0
Last Post: 03-01-2002, 01:08 PM
-
By Mario in forum Database
Replies: 2
Last Post: 07-29-2000, 07:45 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks