Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Monday, March 26, 2012

Newbie Access Database Question

I'm just starting to learn ASP.net, I have a lot of ASP experience, which probably makes ASP.net even more confusing. Basically what I'm trying to do is read data from an access database and then repeat a certain format until the last database entry. I'll give an example

Database has 5 columns: Section, Author, Title, Link, Bibiography

Website:

Section
Author, Title (linked), Bibiography
...
Author...
Section
Author...

Make sense?

This would be very easy in asp, but I haven't quite gotten the grasp of .netSuggestion: Forget ASP. Yeah it stinks to start over, but it's easier that way.

the 'dot net way':

Grab the data into a data set. Check out theTutorials (linked above). There are also a ton of other sites out there for accessing data from a database with .NET. Search for '.NET + Access + DataSet'.

Once you have it in a DataSet object the rest is sooooo easy. Just setup a repeater object on the page. Then an 'item template' and define how you want each item to look like. Lastly add a seperator template if you want something between records. Finally in the code section do MyRepeater.DataSource = MyDataSet.Tables(0) *your data, then MyRepeater.DataBind() and you'll be all set. If you want tabular data without too crazy of formatting, check out the DataGrid. If you just want to list the results in columns you do the DataSource line from above (except you use a DataGrid object) and the DataBind method call. The rest is automagic.

If you need help with the data access, check out the Access forum in the Data Discussions section.

-Ryan
You can use a Repeater, DataList, or DataGrid for this purpose. This tutorial might be helpful:Binding to Data Display Controls. See also the Tutorials section of this site (in particularData Access and Customization). I think a DataList might suit your purposes pretty well, or a Repeater if you need more control (but also requires more coding).

Terri
thanks for the quick responces...

I looked up how to use the repeater control and it seems like this is what I'm looking for. Is the best way to group all of the same sections together to make an if statment? Is that legal within a repeater? Here's what a sample database looks like

General, Blah, Blah
General, Blah2...
Science, Blah3...
Science, Blah4...

I'd like it to:

General
blah
blah2
Science
blah3
blah4

Thanks for all your help
I think you want to put a Order By clause in your SQL Query.


Select Section, Author, Title, Link, Bibiography from MyDB
Order By Section, Author DESC

This will return
General, bob, bobs book, xxx, xxxx
General, sarah, sarahs book, xxx, xxxx
General, tim, tims book, xxx, xxxx
Science, joe, joes book, xxx, xxx

It first sorts Section alphabetically and then within all matching sections it then sorts on the author.

newbie asp/ado.net question.

Hi,

I am very new to .net but not new to asp or ado.

I am just wondering the best way to do the following...

I have a database which stores a list of messages/threads (like google
newsgroups threads). I want to display these on a webpage where each message
is a hyperlink, and each message has a treeview drill-down mechanism where
you can see replies for a particular message (just like in outlook express
newsgroups).

i have an aspx page which i want to display the data and an object which
should do all the retrieving/updating of data.

what is the best way to do this (in terms of using datareader, dataset,
etc). and where would be the logical place to dim these objects (asp or
object)?

one more thing... i would like to return the data from the object in XML
(unless .net has a newer easier way in presenting such information!)

thanks.One of the great things about .NET is the fact that there are tons of ways
to accomplish the same task, so I'm sure you will get tons of answers. ;-)

That being said, if all you want to do, is format the equivalent of a
forward-looking ado recordset, then I would just databind a DataReader to a
DataList or Repeater.

However, if you want to go with XML, I would bring back a dataset, and then
use the WriteXML() method.

hth,
Dave
www.aspNetEmail.com

"linz" <linz@.nospam.com> wrote in message
news:uy8yVwZQDHA.2480@.tk2msftngp13.phx.gbl...
> Hi,
> I am very new to .net but not new to asp or ado.
> I am just wondering the best way to do the following...
> I have a database which stores a list of messages/threads (like google
> newsgroups threads). I want to display these on a webpage where each
message
> is a hyperlink, and each message has a treeview drill-down mechanism where
> you can see replies for a particular message (just like in outlook express
> newsgroups).
> i have an aspx page which i want to display the data and an object which
> should do all the retrieving/updating of data.
> what is the best way to do this (in terms of using datareader, dataset,
> etc). and where would be the logical place to dim these objects (asp or
> object)?
> one more thing... i would like to return the data from the object in XML
> (unless .net has a newer easier way in presenting such information!)
> thanks.
hmm... kinda hard to answer, because I don't know enough about your app.

You wanted XML, I was just making you aware there is a WriteXML() method on
the DataSet, that's all.

If you can, I would return all the data at once, as much as makes sense.
Database connections are relatively expensive, so I would try to minimize
them to a certain extent.

I don't understand what you mean about scope, as the architecture of the web
as stayed the same (still stateless), just the way we are designing apps has
changed 1000%.

You may want to try a different ideas, and ask about more opinions.

hth,
Dave
www.aspNetEmail.com

"phillipa" <phillipa@.nospamming.com> wrote in message
news:urfF0SaQDHA.4024@.tk2msftngp13.phx.gbl...
> thanks, so do you mean dim a dataset in my object and use it to return xml
> back to the aspx page.?
> what about scope? does it work in the same way as classic asp? (ie:
> everytime a user clicks on a message, should i be recreating a connection
to
> the database in my object and populating the message data into a dataset
> then writing the xml back to the aspx page?)
> this is the bit i am unclear about.
>
> "dave wanta" <nospam@.nospam.com> wrote in message
> news:%23r09syZQDHA.2460@.TK2MSFTNGP10.phx.gbl...
> > One of the great things about .NET is the fact that there are tons of
ways
> > to accomplish the same task, so I'm sure you will get tons of answers.
;-)
> > That being said, if all you want to do, is format the equivalent of a
> > forward-looking ado recordset, then I would just databind a DataReader
to
> a
> > DataList or Repeater.
> > However, if you want to go with XML, I would bring back a dataset, and
> then
> > use the WriteXML() method.
> > hth,
> > Dave
> > www.aspNetEmail.com
> > "linz" <linz@.nospam.com> wrote in message
> > news:uy8yVwZQDHA.2480@.tk2msftngp13.phx.gbl...
> > > > Hi,
> > > > I am very new to .net but not new to asp or ado.
> > > > I am just wondering the best way to do the following...
> > > > I have a database which stores a list of messages/threads (like google
> > > newsgroups threads). I want to display these on a webpage where each
> > message
> > > is a hyperlink, and each message has a treeview drill-down mechanism
> where
> > > you can see replies for a particular message (just like in outlook
> express
> > > newsgroups).
> > > > i have an aspx page which i want to display the data and an object
which
> > > should do all the retrieving/updating of data.
> > > > what is the best way to do this (in terms of using datareader,
dataset,
> > > etc). and where would be the logical place to dim these objects (asp
or
> > > object)?
> > > > one more thing... i would like to return the data from the object in
XML
> > > (unless .net has a newer easier way in presenting such information!)
> > > > thanks.
> >

Newbie DataTable question

Stupid question for the day,

Just playing around with rewriting my website in .Net, I want to add a
record to my database table, in the old ADO, it was simple you could
create a connection and recordset and then rs.AddNew etc... in .Net it
seems they recommend that you populate a DataTable then use the
NewRow method

Isnt this bringing back a entire copy of the table (in this case 40,000
users), if so isn't this very inefficient? I know you can run a
insert via a ExecuteNonQuery which is the way I have done it in the
past (usually passing parameters to stored procs)

But I would have thought you should be able to add a row (Datarow) in
this case to a table without returning the entire table when you
connect to it.

Probably being very stupid

heres my code

try
{
// Initializations
string database = "MyDB.mdb";
string connectionString =
@dotnet.itags.org."Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Z:\Web\Database\" +
database;

//connection
OleDbConnection cnn = new OleDbConnection();
cnn.ConnectionString = connectionString;
cnn.Open();

OleDbCommand com = cnn.CreateCommand();
com.CommandText = "Select * from tblUser";

OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = com;

//DataSet ds = new DataSet();
//da.Fill(ds, "Users");

DataTable dt = new DataTable();
da.Fill(dt);

//DataRow dr = dt.Rows[0];
DataRow dr = dt.NewRow();

dr["FirstName"] = FirstName.ToString();
dr["Surname"] = Surname.ToString();
dr["Email"] = Email.ToString();

dt.Rows.Add(dr);
da.Update(dt);

//close up

cnn.Close();
}
catch (OleDbException ee)
{
Console.WriteLine(ee.ToString());
}the notion of in-memory datasets, is you only keep a copy of what you need.
the premise is that normally you only need a subset of the data. a dataset
keeps track of the status of a row (new, modified,deleted,unchanged). then
the adapter can look at the row status to determine whether to insert,
delete, update, or do nothing.

in your case you are loading the dataset solely to get the structure. you
could use the folowwing statement.

com.CommandText = "Select * from tblUser where 1 = 0";

which would only return column info and no data. a better approach is to use
typed datasets. here you use a wizard to build a dataset class that initials
the table and column info. this removes the requirement to do a dummy
database select. also you get a dot notion for accessing column data.

-- bruce (sqlwork.com)

"Ben" <BenScott@.aemail4u.com> wrote in message
news:1151423636.132121.107680@.75g2000cwc.googlegro ups.com...
> Stupid question for the day,
>
> Just playing around with rewriting my website in .Net, I want to add a
> record to my database table, in the old ADO, it was simple you could
> create a connection and recordset and then rs.AddNew etc... in .Net it
> seems they recommend that you populate a DataTable then use the
> NewRow method
>
> Isnt this bringing back a entire copy of the table (in this case 40,000
> users), if so isn't this very inefficient? I know you can run a
> insert via a ExecuteNonQuery which is the way I have done it in the
> past (usually passing parameters to stored procs)
>
> But I would have thought you should be able to add a row (Datarow) in
> this case to a table without returning the entire table when you
> connect to it.
>
> Probably being very stupid
> heres my code
> try
> {
> // Initializations
> string database = "MyDB.mdb";
> string connectionString =
> @."Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Z:\Web\Database\" +
> database;
> //connection
> OleDbConnection cnn = new OleDbConnection();
> cnn.ConnectionString = connectionString;
> cnn.Open();
> OleDbCommand com = cnn.CreateCommand();
> com.CommandText = "Select * from tblUser";
> OleDbDataAdapter da = new OleDbDataAdapter();
> da.SelectCommand = com;
> //DataSet ds = new DataSet();
> //da.Fill(ds, "Users");
> DataTable dt = new DataTable();
> da.Fill(dt);
> //DataRow dr = dt.Rows[0];
> DataRow dr = dt.NewRow();
> dr["FirstName"] = FirstName.ToString();
> dr["Surname"] = Surname.ToString();
> dr["Email"] = Email.ToString();
> dt.Rows.Add(dr);
> da.Update(dt);
> //close up
> cnn.Close();
> }
> catch (OleDbException ee)
> {
> Console.WriteLine(ee.ToString());
> }
thanks Bruce,

yeah as you where writing i had tried that, bit quicker, but then it
wont allow me to insert data

"Update requires a valid InsertCommand when passed DataRow collection
with new rows."

so i guess i need to change

da.SelectCommand = com;

to

da.InsertCommand = com;

that doesnt work :(. any more words of wisdom? the main reason i am
doing this is to avoid having to handle what data is being put into
each field when the users submit the data. creating a Insert string
seem to me the wrong way to do this.

Newbie DataTable question

Stupid question for the day,
Just playing around with rewriting my website in .Net, I want to add a
record to my database table, in the old ADO, it was simple you could
create a connection and recordset and then rs.AddNew etc... in .Net it
seems they recommend that you populate a DataTable then use the
NewRow method
Isnt this bringing back a entire copy of the table (in this case 40,000
users), if so isn't this very inefficient? I know you can run a
insert via a ExecuteNonQuery which is the way I have done it in the
past (usually passing parameters to stored procs)
But I would have thought you should be able to add a row (Datarow) in
this case to a table without returning the entire table when you
connect to it.
Probably being very stupid
heres my code
try
{
// Initializations
string database = "MyDB.mdb";
string connectionString =
@dotnet.itags.org."Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Z:\Web\Database\" +
database;
//connection
OleDbConnection cnn = new OleDbConnection();
cnn.ConnectionString = connectionString;
cnn.Open();
OleDbCommand com = cnn.CreateCommand();
com.CommandText = "Select * from tblUser";
OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = com;
//DataSet ds = new DataSet();
//da.Fill(ds, "Users");
DataTable dt = new DataTable();
da.Fill(dt);
//DataRow dr = dt.Rows[0];
DataRow dr = dt.NewRow();
dr["FirstName"] = FirstName.ToString();
dr["Surname"] = Surname.ToString();
dr["Email"] = Email.ToString();
dt.Rows.Add(dr);
da.Update(dt);
//close up
cnn.Close();
}
catch (OleDbException ee)
{
Console.WriteLine(ee.ToString());
}the notion of in-memory datasets, is you only keep a copy of what you need.
the premise is that normally you only need a subset of the data. a dataset
keeps track of the status of a row (new, modified,deleted,unchanged). then
the adapter can look at the row status to determine whether to insert,
delete, update, or do nothing.
in your case you are loading the dataset solely to get the structure. you
could use the folowwing statement.
com.CommandText = "Select * from tblUser where 1 = 0";
which would only return column info and no data. a better approach is to use
typed datasets. here you use a wizard to build a dataset class that initials
the table and column info. this removes the requirement to do a dummy
database select. also you get a dot notion for accessing column data.
-- bruce (sqlwork.com)
"Ben" <BenScott@.aemail4u.com> wrote in message
news:1151423636.132121.107680@.75g2000cwc.googlegroups.com...
> Stupid question for the day,
>
> Just playing around with rewriting my website in .Net, I want to add a
> record to my database table, in the old ADO, it was simple you could
> create a connection and recordset and then rs.AddNew etc... in .Net it
> seems they recommend that you populate a DataTable then use the
> NewRow method
>
> Isnt this bringing back a entire copy of the table (in this case 40,000
> users), if so isn't this very inefficient? I know you can run a
> insert via a ExecuteNonQuery which is the way I have done it in the
> past (usually passing parameters to stored procs)
>
> But I would have thought you should be able to add a row (Datarow) in
> this case to a table without returning the entire table when you
> connect to it.
>
> Probably being very stupid
> heres my code
> try
> {
> // Initializations
> string database = "MyDB.mdb";
> string connectionString =
> @."Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Z:\Web\Database\" +
> database;
> //connection
> OleDbConnection cnn = new OleDbConnection();
> cnn.ConnectionString = connectionString;
> cnn.Open();
> OleDbCommand com = cnn.CreateCommand();
> com.CommandText = "Select * from tblUser";
> OleDbDataAdapter da = new OleDbDataAdapter();
> da.SelectCommand = com;
> //DataSet ds = new DataSet();
> //da.Fill(ds, "Users");
> DataTable dt = new DataTable();
> da.Fill(dt);
> //DataRow dr = dt.Rows[0];
> DataRow dr = dt.NewRow();
> dr["FirstName"] = FirstName.ToString();
> dr["Surname"] = Surname.ToString();
> dr["Email"] = Email.ToString();
> dt.Rows.Add(dr);
> da.Update(dt);
> //close up
> cnn.Close();
> }
> catch (OleDbException ee)
> {
> Console.WriteLine(ee.ToString());
> }
>
thanks Bruce,
yeah as you where writing i had tried that, bit quicker, but then it
wont allow me to insert data
"Update requires a valid InsertCommand when passed DataRow collection
with new rows."
so i guess i need to change
da.SelectCommand = com;
to
da.InsertCommand = com;
that doesnt work :(. any more words of wisdom? the main reason i am
doing this is to avoid having to handle what data is being put into
each field when the users submit the data. creating a Insert string
seem to me the wrong way to do this.

Saturday, March 24, 2012

newbie dropdownlist question

I'm sure this is obvious but.

I have an employee details form for an intranet to a sql server database. A number of controls in the form will be dropdown lists used as lookups. ie I have a jobno in the employee
table which would be linked to a jobsid in a jobs table. The only table which would be updated is the employee table.

I am using a separate datasets. I cant set the datatext to jobs.id and the datavalue to employee.jobno

The item shown in the list would be the employees id.

I don't know if the dataset would be the corect method?

Any assistance greatly appreciated.Write a query/view (woteva) using links to retrieve the required data for the dropdownlist and populate it into the same DataSet.

Thursday, March 22, 2012

Newbie image question.

How do i display an image stored in a database in an
asp.net web form?

I assume the image need not to be scaled.On Sat, 12 Jun 2004 03:38:37 +0200, Jensen bredal
<jensen.bredal@.mimosa.com> wrote:

> How do i display an image stored in a database in an
> asp.net web form?
> I assume the image need not to be scaled.

For some reason, I couldn't find a simpler example than this:

http://www.codeproject.com/aspnet/image_asp.asp

Check out the latter part of the article, view.aspx is what you're looking
for. The only thing is the author created a custom class for DB
interaction, don't let it confuse you in the code. The DB access code is
above the section I'm referring to.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
On Sat, 12 Jun 2004 20:58:36 -0500, Craig Deelsnyder
<cdeelsny@.no_spam_4_meyahoo.com> wrote:

> On Sat, 12 Jun 2004 03:38:37 +0200, Jensen bredal
> <jensen.bredal@.mimosa.com> wrote:
>> How do i display an image stored in a database in an
>> asp.net web form?
>>
>> I assume the image need not to be scaled.
>>
>>
> For some reason, I couldn't find a simpler example than this:
> http://www.codeproject.com/aspnet/image_asp.asp
> Check out the latter part of the article, view.aspx is what you're
> looking for. The only thing is the author created a custom class for DB
> interaction, don't let it confuse you in the code. The DB access code
> is above the section I'm referring to.

dang, sorry for the extra reply...my newsreader broke the thread and i
didn't notice...

enjoy...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Well that example was great too. But i have noticed two things compare with
previous link i got.

The example here does not tell you how to display the image from a datagrid
as an example.

And other thing that is common to both example is that the
response.ContenType is not set from a value in database.
Im my code i also do store Response.ContentType and
that should lead to the following:

Response.ContentType = dr[ImageContentType].ToString();
where dr is the datarow containing my image info.

Many thanks

"Craig Deelsnyder" <cdeelsny@.no_spam_4_meyahoo.com> wrote in message
news:opr9if21dg75dg5d@.tux...
> On Sat, 12 Jun 2004 20:58:36 -0500, Craig Deelsnyder
> <cdeelsny@.no_spam_4_meyahoo.com> wrote:
> > On Sat, 12 Jun 2004 03:38:37 +0200, Jensen bredal
> > <jensen.bredal@.mimosa.com> wrote:
> >> How do i display an image stored in a database in an
> >> asp.net web form?
> >>
> >> I assume the image need not to be scaled.
> >>
> >>
> > For some reason, I couldn't find a simpler example than this:
> > http://www.codeproject.com/aspnet/image_asp.asp
> > Check out the latter part of the article, view.aspx is what you're
> > looking for. The only thing is the author created a custom class for DB
> > interaction, don't let it confuse you in the code. The DB access code
> > is above the section I'm referring to.
> dang, sorry for the extra reply...my newsreader broke the thread and i
> didn't notice...
> enjoy...
> --
> Craig Deelsnyder
> Microsoft MVP - ASP/ASP.NET

Newbie image question.

How do i display an image stored in a database in an
asp.net web form?
I assume the image need not to be scaled.Jensen,
Here's an article that Dino Esperante wrote on the subject: -
http://www.ftponline.com/vsm/2002_0...ttips/esposito/
Hth,
Phil Winstanley
Microsoft ASP.NET MVP
http://www.myservicescentral.com
Dino Esposito rather! :-) Sorry Dino!
Phil.
Phil Winstanley [Microsoft MVP ASP.NET] wrote:
> Jensen,
> Here's an article that Dino Esperante wrote on the subject: -
> http://www.ftponline.com/vsm/2002_0...ttips/esposito/
> Hth,
> Phil Winstanley
> Microsoft ASP.NET MVP
> http://www.myservicescentral.com
Thank you...
"Phil Winstanley [Microsoft MVP ASP.NET]" <phil@.winstanley.name> wrote i
n
message news:caepln$c1s@.odbk17.prod.google.com...
> Dino Esposito rather! :-) Sorry Dino!
> Phil.
> Phil Winstanley [Microsoft MVP ASP.NET] wrote:
>
On Sat, 12 Jun 2004 03:38:37 +0200, Jensen bredal
<jensen.bredal@.mimosa.com> wrote:

> How do i display an image stored in a database in an
> asp.net web form?
> I assume the image need not to be scaled.
>
For some reason, I couldn't find a simpler example than this:
http://www.codeproject.com/aspnet/image_asp.asp
Check out the latter part of the article, view.aspx is what you're looking
for. The only thing is the author created a custom class for DB
interaction, don't let it confuse you in the code. The DB access code is
above the section I'm referring to.
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
On Sat, 12 Jun 2004 20:58:36 -0500, Craig Deelsnyder
<cdeelsny@.no_spam_4_meyahoo.com> wrote:

> On Sat, 12 Jun 2004 03:38:37 +0200, Jensen bredal
> <jensen.bredal@.mimosa.com> wrote:
>
> For some reason, I couldn't find a simpler example than this:
> http://www.codeproject.com/aspnet/image_asp.asp
> Check out the latter part of the article, view.aspx is what you're
> looking for. The only thing is the author created a custom class for DB
> interaction, don't let it confuse you in the code. The DB access code
> is above the section I'm referring to.
>
dang, sorry for the extra reply...my newsreader broke the thread and i
didn't notice...
enjoy...
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Well that example was great too. But i have noticed two things compare with
previous link i got.
The example here does not tell you how to display the image from a datagrid
as an example.
And other thing that is common to both example is that the
response.ContenType is not set from a value in database.
Im my code i also do store Response.ContentType and
that should lead to the following:
Response.ContentType = dr[ImageContentType].ToString();
where dr is the datarow containing my image info.
Many thanks
"Craig Deelsnyder" <cdeelsny@.no_spam_4_meyahoo.com> wrote in message
news:opr9if21dg75dg5d@.tux...
> On Sat, 12 Jun 2004 20:58:36 -0500, Craig Deelsnyder
> <cdeelsny@.no_spam_4_meyahoo.com> wrote:
>
> dang, sorry for the extra reply...my newsreader broke the thread and i
> didn't notice...
> enjoy...
> --
> Craig Deelsnyder
> Microsoft MVP - ASP/ASP.NET

Newbie master/detail question

I have a form that collects info for a database. I can insert the master record using a dataset but how to I get the sql server generated id back from the db to use in my detail inserts?Readthis discussion

Newbie Membership question

I have a database that I want to basically place on the web. I have user information inside a table within this database. The database is an SQL Server DB. My question is how to use the membership and role features when a db with user info is already created. Are there any good examples of this out there? Thanks.

First off: there is a whole "Security" forum dedicated to membership and role talk

Secondly: what you are going to be after is a "Customer Membership Provider"


I also have a list of good security resources on ASP.NET 2.0 here:http://weblogs.asp.net/scottgu/archive/2006/02/24/438953.aspx

It includes a nice video that walksthrough how to setup a login system.

Hope this helps,

Scott

Friday, March 16, 2012

Newbie needs quick help

I need to update my database. I receive the Id in a url string:
https://128bit.clickandpledge.com/Shopping/BNewUser.aspx?I=344
Where ' I ' in the url is the following: 34 would be the id of the record in the database and the last number 4 would be the number I need to subtract from the total available tickets in the database.
So here is how it goes. A user goes to the site, they want to purchase 4 tickets. They enter in 4 in the input the box and off to the payment processor. I do not collect any information on the website itself. After processing the database record ID and the purhased tickets are joined together as one number in the url. I need to parse the first two numbers and use in my where clause and the last number I need to subtract from the available field in the database.
I have no idea how to do this. I know it has to be simple. Help
tonyDim stringI as string
stringI = Request.QueryString("I")
Dim intRec as Integer
intRec = CInt(Left(I,2))
Dim intQty as Integer
intQty = CInt(Right(I,1))

You really should sit at the drawing board a little longer. What happens when you hit record number 99? What happened prior to record 10?
If you insist on using a query string then you should probably use 2 parameters. Ie.,http://www.yoursite.com?I=34&J=4
That saves you the trouble of concatenating them in the first place.
Then the code is simple
int Record = Convert.ToInt16(Request.QueryString["I"]);
int Tickets = Convert.ToInt16(Request.QueryString["J"]);

just my 2 cents.

Newbie needs VWDE deployment help. Need to import database from local machine to shared ho

Greetings,

I'm trying to migrate a website on shared hosting (Godaddy) from Classic ASP to ASP.Net. Having one major issue.

I have figured out that when you create roles and users in VWDE, it creates a database(aspnetdb.mdf) in the App_Data directory and that is where the informaion is stored. On my shared hosting through Godaddy, you can select "schema features" that sets up your SQL database with all the tables the same (or at least very similar) to the aspnetdb database.

I've been wading through countless posts regarding issues with Godaddy / ASP,Net. Most of the posts are guys having problems with getting a personal starter website running. The resolution involves an .sql file. The the t-SQL statements are cut and pasted into an online tool that godaddy has on their site. This then populates the database. How that file gets created I don't know.

Long story short (oops, too late for that!), how can I export my aspnetdb.mdf data into an .sql file that I can then cut and paste into godaddy's online tool?

Important point -- You cannot connect remotely to the SQL server with godaddy so that option's out.

Please advise,

Thanks

Dave.

So are you wanting to generate sql scripts to duplicate the database you have created locally on Go Daddy's server correct? If you are using enterprise manager you should be able to generate the scripts with a right click option. When I setup membership and roles for a 2.0 site I utilized a free tool I found online somewhere - this tool allowed me to connect directly to my hosting company's sql server and modifiy users directly, but like you said you can't do that with GoDaddy.

When I'm in SQL Server Management Studio Exprees, I can attach to the aspnetdb file and see the little bit of data I have in there. When I right click on a table and go "Script Table as >" ! "Insert to >" | "File..." it gives me this:

INSERT INTO [C:\DOCUMENTS AND SETTINGS\COMPAQ_OWNER\MY DOCUMENTS\VISUAL STUDIO 2005\KOKOFEES\APP_DATA\ASPNETDB.MDF].[dbo].[aspnet_Users]
([ApplicationId]
,[UserId]
,[UserName]
,[LoweredUserName]
,[MobileAlias]
,[IsAnonymous]
,[LastActivityDate])
VALUES
(<ApplicationId, uniqueidentifier,>
,<UserId, uniqueidentifier,>
,<UserName, nvarchar(256),>
,<LoweredUserName, nvarchar(256),>
,<MobileAlias, nvarchar(16),>
,<IsAnonymous, bit,>
,<LastActivityDate, datetime,>)

There are 3 rows of data in this table, What am I doing wrong?


Hmm... not really sure. Have you researched the bcp utility? I'm not sure if it's included with the Express edition. Also you can google Bulk Insert and you should get some ideas. Here's a link to a solution in T-SQL that inserts data into a table from text files.

http://www.sqlteam.com/item.asp?ItemID=3207