The following are things that you might want to recheck if
you're having problems.
-
Specifying the data source incorrectly. Depending on the database in question, the correct name, path, user ID, and password may need to be specified. The ADO.NET error message, though, is both polite and obvious - it will be something like Could not find file 'C:\BegASPNETdb\datastores\Southwind.mdb'.
-
Forgetting to specify namespaces, or doing so with the wrong syntax. This creates an error such as Type OleDbConnection not found.
-
Using the wrong object. Sometimes, people will try to use strConnection.Open() instead of objConnection.Open(). Once the connection object is created (objConnection), it is used in the rest of the page. The variable holding the connection string is only used to instantiate the connection object. This mistake produces errors such as The Open method is not a member of 'String'.
-
Trying to use unopened connection objects. Connection objects must be opened (not just instantiated) before they can be used. This mistake leads to clear error messages such as To use XXX object your Connection object must be Open.
-
Skipping the New keyword when declaring the connection object. This produces an error message such as Array bounds cannot appear in type specifiers.
-
Typing errors in the syntax of the connection string. You need to be careful here, as the syntax is different from normal Visual Basic syntax (spaces are allowed, arguments are separated by semicolons). This type of mistake tends to yield unhelpful error messages pointing to the Connection.Open() line, rather than the line where the connection object is declared. The most common ones are as follows:
-
Not putting a space in data source yields a message such as Could not find installable ISAM, pointing to the Connection.Open() line.
-
Using a comma instead of a semicolon to separate arguments yields an error message such as No error information available, pointing to the Connection.Open() line.
-
Forgetting a semicolon between arguments also yields an error message such as No error information available, pointing to the Connection.Open() line. This mistake might occur when you're concatenating or appending more than one argument across several lines of code.
-
If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website
Imports System.Data
ReplyDeleteImports System.Data.SqlClient
Partial Class SendAbstract
Inherits System.Web.UI.Page
Dim con1 As New SqlConnection("Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\classmates.mdf;Integrated Security=True")
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim s As String
s = "Update stu1 set abstract = '" & TextBox2.Text & "' where = '" & TextBox2.Text & "'"
Dim co1 As SqlCommand(s, con1)
con1.Open()
co1.ececuteNonQuery()
End Sub
End Class
Getting "Array bounds cannot appear in type specifiers." ERROR
any soln...?
pls correct syntax co1.executeNonQuery()
ReplyDelete