Search:
Namespaces
Discussions
.NET v1.1
Feedback
SQLDataAdapter parameter not supplied during insert?
Messages
Related Types
This message was discovered on
ASPFriends.com 'ngfx-sqlclient' list
.
Gary Milczarek
-- Moved from [aspngstart] to [ngfx-sqlclient] by Tony Stark <
Click here to reveal e-mail address
> --
I'm trying to insert data from a form into SQL Server database. I
dragged
the fields from the database onto the form to create a SQLDataAdapter,
which
creates an automatic insert command.
My submit button calls:
SqlConnection1.Open()
SqlDataAdapter1.InsertCommand.ExecuteNonQuery()
SqlConnection1.Close()
When I submit, I get the error:
Prepared statement '(@UserName varchar(15),@UserPassword
varchar(15),@FirstName varc' expects parameter @UserName, which was not
supplied.
Yet when I look in the SQLDataAdapter auto generated code I see:
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.
SqlParameter
("@UserName",
System.Data.
SqlDbType
.VarChar, 15, txtUserName.Text))
Isn't that the parameter wanted. What is happening here, and what else
do I
need to do?
Thanks,
Gary
Reply to this message...
Alex Dresko
Perhaps the parameter is there as it should be, but there is not a value
supplied for the parameter?
Alex Dresko
Three Point Oh!
-----Original Message-----
From: Gary Milczarek [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, July 16, 2002 11:27 AM
To: ngfx-sqlclient
Subject: [ngfx-sqlclient] SQLDataAdapter parameter not supplied during
insert?
-- Moved from [aspngstart] to [ngfx-sqlclient] by Tony Stark
<
Click here to reveal e-mail address
> --
I'm trying to insert data from a form into SQL Server database. I
dragged
the fields from the database onto the form to create a SQLDataAdapter,
which
creates an automatic insert command.
My submit button calls:
SqlConnection1.Open()
SqlDataAdapter1.InsertCommand.ExecuteNonQuery()
SqlConnection1.Close()
When I submit, I get the error:
Prepared statement '(@UserName varchar(15),@UserPassword
varchar(15),@FirstName varc' expects parameter @UserName, which was not
supplied.
Yet when I look in the SQLDataAdapter auto generated code I see:
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.
SqlParameter
("@UserName",
System.Data.
SqlDbType
.VarChar, 15, txtUserName.Text))
Isn't that the parameter wanted. What is happening here, and what else
do I
need to do?
Thanks,
Gary
| [ngfx-sqlclient] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.aspfriends.com/aspfriends/ngfx-sqlclient.asp
= JOIN/QUIT
Reply to this message...
Gary Milczarek
Indeed, that was the missing part. Here is what worked:
SqlInsertCommand1.Parameters("@UserName").Value = txtUserName.Text
I really couldn't find any documentation or examples of how to use the
DataAdapter
in this way and that made it clear what was needed.
Thanks for your response, Alex.
Gary
-----Original Message-----
From: Alex Dresko [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, July 16, 2002 12:58 PM
To: ngfx-sqlclient
Subject: [ngfx-sqlclient] RE: SQLDataAdapter parameter not supplied
during insert?
Perhaps the parameter is there as it should be, but there is not a value
supplied for the parameter?
Alex Dresko
Three Point Oh!
-----Original Message-----
From: Gary Milczarek [mailto:
Click here to reveal e-mail address
]
Sent: Tuesday, July 16, 2002 11:27 AM
To: ngfx-sqlclient
Subject: [ngfx-sqlclient] SQLDataAdapter parameter not supplied during
insert?
-- Moved from [aspngstart] to [ngfx-sqlclient] by Tony Stark
<
Click here to reveal e-mail address
> --
I'm trying to insert data from a form into SQL Server database. I
dragged
the fields from the database onto the form to create a SQLDataAdapter,
which
creates an automatic insert command.
My submit button calls:
SqlConnection1.Open()
SqlDataAdapter1.InsertCommand.ExecuteNonQuery()
SqlConnection1.Close()
When I submit, I get the error:
Prepared statement '(@UserName varchar(15),@UserPassword
varchar(15),@FirstName varc' expects parameter @UserName, which was not
supplied.
Yet when I look in the SQLDataAdapter auto generated code I see:
Me.SqlInsertCommand1.Parameters.Add(New
System.Data.SqlClient.
SqlParameter
("@UserName",
System.Data.
SqlDbType
.VarChar, 15, txtUserName.Text))
Isn't that the parameter wanted. What is happening here, and what else
do I
need to do?
Thanks,
Gary
| [ngfx-sqlclient] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.aspfriends.com/aspfriends/ngfx-sqlclient.asp
= JOIN/QUIT
| [ngfx-sqlclient] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.aspfriends.com/aspfriends/ngfx-sqlclient.asp
= JOIN/QUIT
Reply to this message...
System.Data.Common.DataAdapter
System.Data.SqlClient.SqlParameter
System.Data.SqlDbType
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com