i am getting this error

sayali dhanawade 20 Reputation points
2024-11-30T11:08:29.9066667+00:00

User's image

please give me some solution for SqlConnection, SqlCommand and Clear ()

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,915 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
4,011 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,223 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,760 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Erland Sommarskog 114.6K Reputation points MVP
    2024-11-30T11:44:39.7166667+00:00

    Don't use the connection-string property AttachDBFilename. I don't know why this option was ever invented. It's certainly nothing you would ever use in real life, that is, production.

    Use the option Initial Catalog to specify the name of the database (not the path to it). It already exists in your localDB instance, doesn't it?

    0 comments No comments

  2. SurferOnWww 3,616 Reputation points
    2024-11-30T22:10:24.8833333+00:00

    What are the fname, lname, phone, email and password? I guess that they are TextBox control?

    The TextBox does not have Clear() method. Try using Text property and set string.Empty to it.

    Note that mentioned above will solve only the errors you showed. There are lot of fundamental problems in use of ADO.NET. You will have to study it to obtain fundamental knowledge.

    0 comments No comments

  3. Bruce (SqlWork.com) 68,716 Reputation points
    2024-12-01T17:06:05.04+00:00

    I would guess you have a build error. Delete the obj and bin folders. Then do a rebuild. Fix any errors.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.