473,396 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Updating a data user using vb.net2008 and sql server management studio express

please help me i'm trying to update a data user using vb.net2008 and sql server management studio express for my backend. the error says "must declare the scalar variable "@username" here's the code .
Expand|Select|Wrap|Line Numbers
  1.     Private Sub btnupdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnupdate.Click
  2.  
  3.  
  4.         Dim connstring = New SqlClient.SqlConnection("Data Source=MISD-ASBAUTISTA\SQLEXPRESS;Initial Catalog=inventory system;Integrated Security=SSPI;")
  5.         Dim adapt = New SqlClient.SqlDataAdapter("select Username, Password from tbl_user", connstring)
  6.         Dim dset As DataSet = New DataSet
  7.         Dim cmdAdd As New SqlClient.SqlCommand()
  8.         connstring.Open()
  9.         cmdAdd.Connection = connstring
  10.  
  11.  
  12.         cmdAdd.CommandText = "update username SET username = @username, password = @password, where tbl_user = @user"
  13.  
  14.  
  15.         cmdAdd.ExecuteNonQuery() 'error within this line
  16.  
  17.         adapt.Fill(dset, "tbl_user")
  18.         With DataGridView1
  19.             .DataMember = "tbl_user"
  20.             .DataSource = dset.DefaultViewManager
  21.             .Update()
  22.         End With
  23.         MsgBox("Account has been updated!", MsgBoxStyle.Information, "SUCCESS")
please help me.. thank you :p
Apr 19 '11 #1
1 1921
MrMancunian
569 Expert 512MB
Where do you declare @Username and how does it get its value? Did you write this yourself or did you copy/paste it? Check out this insight to find out how a query should look.

Steven
May 26 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: hch | last post by:
dataAdapter.Update(data, "TableName") won’t work! I was about to deploy my first website on the Internet only to discover that the dataAdapter.Update() throws the Server Error in the third...
3
by: markydev | last post by:
Hi, I'm using sql server 2000 sp4. I've 2 databases linked, an instance and my local. I'm getting two different errors when trying to update the remote table (local server) from the instance....
1
by: Access | last post by:
Here is my function to change a users permission level in the database. This relates to an Access database secured using Access security. This function is called if the end user changes a staff...
5
by: Juande | last post by:
Hello, I have a main page where the user log in to access to the data in SQL Server, the selected data by the user will be exported in a .MDB file into the server, I want that generated file...
5
by: birdcut | last post by:
Sorry for my bad Englush. I've designed a form like this http://img524.imageshack.us/img524/2656/untitled1xj8.jpg The textbox show the classID and the datagird will display the list of students...
1
by: TonyJ | last post by:
Hello! I trying to update a table using sql server but no update will be done. I don't get any error at all. Here is an extract from the code. Does this seems to be right.
0
by: sijugeo | last post by:
Hi, I Have a MS word template field which have certain data fields. I want to populate the data fields using the data retrived from SQL db. How can I do this? Thanks in advance Siju george
2
by: mrajanikrishna | last post by:
Hi, I am importing external data(oracle) to local sql server DB thru linked server. This is actual replica of the external data(not normalized). I need to run this import for every 2 minutes....
1
by: pexp | last post by:
Hello All, I would like to insert/update a database table using excel file. I have a list of products in an excel file. If product exist in a database table tblproduct than it should update the...
3
by: shobhitguptait | last post by:
How to Run C#.NET Windows App on N/W with centralized DB using SQL SERVER 2000 Hello All...i m really grate full to c such a website where developers try to help people like us who face problems...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.