Thank you all for your help so far. That link, looks great but, I am trying to get my head around it and convert it to VB, as the rest of my page and page code is in VB.
http://forums.asp.net/t/1193643.aspx
First thing I don't understand is the connection string - the means of connecting to my database. The thing I don't get is, I'm already connected to my database using, from the top of my head, <%connectionstring:connectionstring%>. I developed the SQL
database inside Visual Wed Developer with SQL Express running in the background. Whenever I create a new dropdown to the page, it knows to use the connectionstring and then allows me to select a table and enter a query, value and text for the dropdown.
So, I don't think I need all that stuff if it is already established? Unless, there is some difference in my connectionstring if it is to read AND write information?
The first hurdle I want to do is, using a button, create a database record in one table called dbo.Job. I know there is also some scripting to do to get the IDENTITY, and then work out how many additional records in a related table I need to make but, right
now, I'm still at the point where I haven't been able to create a single record from my ASPX page.
Let's say for not I have, on the ASPX page.
TextBox - called 'JobName' The TEXT of this to go into JobDescription in the dbo.Job table
DropDown - called 'JobType' The VALUE of this to go into JobTypeID in the dbo.Job table
The only other bit I'd like to know is, if I have a label on my aspx page called JobNumber, how do I do a SELECT IDENTITY of the dbo.Job table and make the label display the Job Number?
Sorry I ask a lot, hopefully, this is simple stuff, I read up so much I end up lost in the process.
mattlightbou...
Member
3 Points
53 Posts
Re: Inserting data into SQL Tables from ASP Form
Dec 19, 2009 10:21 AM|LINK
Hi,
Thank you all for your help so far. That link, looks great but, I am trying to get my head around it and convert it to VB, as the rest of my page and page code is in VB.
http://forums.asp.net/t/1193643.aspx
First thing I don't understand is the connection string - the means of connecting to my database. The thing I don't get is, I'm already connected to my database using, from the top of my head, <%connectionstring:connectionstring%>. I developed the SQL database inside Visual Wed Developer with SQL Express running in the background. Whenever I create a new dropdown to the page, it knows to use the connectionstring and then allows me to select a table and enter a query, value and text for the dropdown.
So, I don't think I need all that stuff if it is already established? Unless, there is some difference in my connectionstring if it is to read AND write information?
The first hurdle I want to do is, using a button, create a database record in one table called dbo.Job. I know there is also some scripting to do to get the IDENTITY, and then work out how many additional records in a related table I need to make but, right now, I'm still at the point where I haven't been able to create a single record from my ASPX page.
Let's say for not I have, on the ASPX page.
TextBox - called 'JobName' The TEXT of this to go into JobDescription in the dbo.Job table
DropDown - called 'JobType' The VALUE of this to go into JobTypeID in the dbo.Job table
The only other bit I'd like to know is, if I have a label on my aspx page called JobNumber, how do I do a SELECT IDENTITY of the dbo.Job table and make the label display the Job Number?
Sorry I ask a lot, hopefully, this is simple stuff, I read up so much I end up lost in the process.
Thanks for all your help
Matt