473,387 Members | 1,757 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,387 software developers and data experts.

FormViews - ASP.NET 2.0

OK, im really struggling with something which sould really be simple I
think.

Ive created an SQL Datasource on a web form and dragged a formview, editted
the Insert Template to make it look nice in a table etc. The table itself
has lots of fields ( About 20 ) and I have set up an Insert statement in the
SQLDatasource, and tested in that that I can insert a record.

So far so good.
Now where I am missing knowledge is how to make the data held in the
formview get updated.

So, my Insert statrement looks something like.

Insert Into Users( NickName) Values(@Nickname) // Obviously there are
more fields

Nows I can execute this in the datasource config an successfully create the
records. However, Im at a bit of a loss as to how to do this fromt he form.

The Isnert Template has bound fields to all the table records.

In the Insert Click handler, I do

Me.formview1.insert(false)

This tried to do the Insert, but I get an exception to tell me that the
value of the nickname field is Null.. What Do I need to do to set up the
connection between the Insert Template and the parameters in the Insert
query

Many Thanks


Apr 11 '07 #1
2 2088
The way I normally do it.

1. Test the fields in the form
2. If there are any nulls, cast them, in the DataSet, to their proper SQL
Type

value = SqlString.Null

as an example.

As long as the field can legally accept null values, this should solve your
issue. A bit heavier than drag and drop, but explicit code is bettter. :-)

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*********************************************
Think outside the box!
*********************************************
"Just Me" <news.microsoft.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
OK, im really struggling with something which sould really be simple I
think.

Ive created an SQL Datasource on a web form and dragged a formview,
editted the Insert Template to make it look nice in a table etc. The
table itself has lots of fields ( About 20 ) and I have set up an Insert
statement in the SQLDatasource, and tested in that that I can insert a
record.

So far so good.
Now where I am missing knowledge is how to make the data held in the
formview get updated.

So, my Insert statrement looks something like.

Insert Into Users( NickName) Values(@Nickname) // Obviously there are
more fields

Nows I can execute this in the datasource config an successfully create
the records. However, Im at a bit of a loss as to how to do this fromt he
form.

The Isnert Template has bound fields to all the table records.

In the Insert Click handler, I do

Me.formview1.insert(false)

This tried to do the Insert, but I get an exception to tell me that the
value of the nickname field is Null.. What Do I need to do to set up the
connection between the Insert Template and the parameters in the Insert
query

Many Thanks

Apr 12 '07 #2
On Apr 11, 2:51 pm, "Just Me" <news.microsoft.comwrote:
OK, im really struggling with something which sould really be simple I
think.

Ive created an SQL Datasource on a web form and dragged a formview, editted
the Insert Template to make it look nice in a table etc. The table itself
has lots of fields ( About 20 ) and I have set up an Insert statement in the
SQLDatasource, and tested in that that I can insert a record.

So far so good.

Now where I am missing knowledge is how to make the data held in the
formview get updated.

So, my Insert statrement looks something like.

Insert Into Users( NickName) Values(@Nickname) // Obviously there are
more fields

Nows I can execute this in the datasource config an successfully create the
records. However, Im at a bit of a loss as to how to do this fromt he form.

The Isnert Template has bound fields to all the table records.

In the Insert Click handler, I do

Me.formview1.insert(false)

This tried to do the Insert, but I get an exception to tell me that the
value of the nickname field is Null.. What Do I need to do to set up the
connection between the Insert Template and the parameters in the Insert
query

Many Thanks
Can we get some sample code of what you're doing? My first guess would
be that the names of your parameters in your insert statement aren't
matching up with the names of your parameters and your Bind calls in
your InsertItemTemplate

Apr 12 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jesper Odgaard | last post by:
Hi, I'm migrating a program to C# that I wrote using MFC. The programs GUI was split vertically in two halfs with a tree control to the left. Accordingly to the different items that could be...
4
by: Daves | last post by:
hi, sorry for re-posting but it's a simple question and ought to have a very simple solution; I am trying to use Findcontrol to grab a Button control within a Formview control: <form ID="Form1"...
0
by: John Bailey | last post by:
I have a dataset with multiple data tables. I need to bind this to a wizard interface, where each portion of the wizard udates the information in one of the datatables. I am using formviews in...
3
by: John Bailey | last post by:
When I first built a few web pages in ASP .Net 2.0, I thought it was great. The formview and detailview contorls would automatically layout the controls for you, the update methods were...
3
by: Michael Glass | last post by:
I'm working on an ASP.Net web app using VS2005 and the .Net 2.0 framework, and I have a serious problem with the page I'm currently working on. The page has, among other things, two FormViews and a...
5
by: mosscliffe | last post by:
Following Mr Tabors Video on Databinding I implemented the following code In GridViewSelectedIndexChange I coded DetailsView1.pageindex = gridview1.selectedindex This works fine for the...
0
by: Larry R | last post by:
I have a page that contains a formview (let's say "Order") that contains another grid/formview (say "OrderDetails"). When I edit the item on the Main Grid, the fvOrder shows up. Since there are...
1
by: dan | last post by:
Hi, I think I need a gridview, formview, another gridview, and another formview on a single page. There is a parent-child relationship between the first gridview and the formview and then...
1
by: etam | last post by:
Hi, I like FormView for its flexibility. Is there something for displaying list of FormViews? If not what is the best way to show dynamic number of FormViews? Thanks in advance, Etam.
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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...

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.