|
I think you can set how they fill the table they create ( how many across, how many down ). If you want more detailed control, I'd imagine you'd want to use a repeater.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i m using the tutorial "href="http://www.sitepoint.com/article/introduction-ado-net/3" to access values from database through ado.net using stored procedure.but its not working.here is my code
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con= new SqlConnection("////here is my connection string/////");
con.Open();
SqlCommand com = new SqlCommand("ShowSuppliers", con);
com.CommandType = CommandType.StoredProcedure;
//SqlDataReader reader = com.ExecuteReader();
SqlParameter parm = com.Parameters.Add("@txt", SqlDbType.VarChar, 50);
parm.Direction = ParameterDirection.Input;
parm.Value = "US";
SqlDataReader reader = com.ExecuteNonQuery();
while (reader.Read()== true)
{
Response.Write(reader[0].ToString() + " ");
}
reader.Close();
con.Close();
}
and one of problem is whenever i m saving my procedure as in tutorial, it always chages "create PROCEDURE" with "ALTER PROCEDURE"
Chohan
|
|
|
|
|
If you would have provided some more specific information about what you mean by "not working", it would have been easier to spot the error.
The ExecuteNonQuery method does not return a data reader, it only returns an integer that represents the number of records affected. If you want a data reader, you should use the ExecuteReader method instead.
chohanpk wrote: and one of problem is whenever i m saving my procedure as in tutorial, it always chages "create PROCEDURE" with "ALTER PROCEDURE"
That is normal. The create command is only used to create a procedure. The alter command is used to update the procedure when editing it.
---
Year happy = new Year(2007);
|
|
|
|
|
but i m following the tutorial.when i m using the executenonquery,it gives the "int " error as u said.and when i m using ExecuteReader before sqlparamerters,as in tutorial,it gives error"Procedure 'ShowSuppliers' expects parameter '@txt', which was not supplied."
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con= new SqlConnection("Data Source=n-6e9a4f688df44;Initial Catalog=Northwind;Integrated Security=True");
con.Open();
SqlCommand com = new SqlCommand("ShowSuppliers", con);
com.CommandType = CommandType.StoredProcedure;
SqlDataReader reader = com.ExecuteReader();
SqlParameter parm = com.Parameters.Add("@txt", SqlDbType.VarChar, 50);
parm.Direction = ParameterDirection.Input;
parm.Value = "UK";
while (reader.Read()== true)
{
Response.Write(reader[0].ToString() + " ");
}
reader.Close();
con.Close();
}
.and when i used ExecuteReader after sqlparameter it shows nothing on output
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con= new SqlConnection("Data Source=n-6e9a4f688df44;Initial Catalog=Northwind;Integrated Security=True");
con.Open();
SqlCommand com = new SqlCommand("ShowSuppliers", con);
com.CommandType = CommandType.StoredProcedure;
SqlDataReader reader = com.ExecuteReader();
SqlParameter parm = com.Parameters.Add("@txt", SqlDbType.VarChar, 50);
parm.Direction = ParameterDirection.Input;
parm.Value = "UK";
//SqlDataReader reader = com.ExecuteNonQuery();
//SqlDataReader reader = com.ExecuteReader();
while (reader.Read()== true)
{
Response.Write(reader[0].ToString() + " ");
}
reader.Close();
con.Close();
}
n for procedure i want to create a procedure then y its changed to Alter.i dont want edit any value. kindly check the tutorial.
Chohan
|
|
|
|
|
chohanpk wrote: but i m following the tutorial.
That doesn't help the least bit when the tutorial is wrong.
chohanpk wrote: when i m using ExecuteReader before sqlparamerters,as in tutorial,it gives error"Procedure 'ShowSuppliers' expects parameter '@txt', which was not supplied."
You have to set the parameter berfore calling the procedure. The procedure can not use a parameter that you add in the future.
chohanpk wrote: n for procedure i want to create a procedure then y its changed to Alter.i dont want edit any value.
When you have created the procedure, it's displayed for you so that you can edit it. Even if you don't want to edit it, it's shown that way. To show it so that you could create it would be pointless, as you have already done that.
---
Year happy = new Year(2007);
|
|
|
|
|
i give parameter befor but now it didnt show anything .just open a blank page.
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con= new SqlConnection("Data Source=n-6e9a4f688df44;Initial Catalog=Northwind;Integrated Security=True");
con.Open();
SqlCommand com = new SqlCommand("ShowSuppliers", con);
com.CommandType = CommandType.StoredProcedure;
//SqlDataReader reader = com.ExecuteReader();
SqlParameter parm = com.Parameters.Add("@txt", SqlDbType.VarChar, 50);
parm.Direction = ParameterDirection.Input;
parm.Value = "UK";
SqlDataReader reader = com.ExecuteReader();
while (reader.Read() == true)
{
Response.Write(reader[0].ToString() + " ");
}
reader.Close();
con.Close();
}
will you plz tel me what will be the right code?
and how can i do it using execute "ExecuteNonQuery", also code for this.
thanks
Chohan
|
|
|
|
|
Do you have any suppliers in the database that matches the condition?
Have you tried "view source" on the page? As you are using Response.Write, you will be writing out the data before the actual html code. That will break the html code so that it might not show, but the data will be visible in the source of the page.
---
Year happy = new Year(2007);
|
|
|
|
|
sorry i didnt understand what u asked? as i m begginer in asp.net.
Chohan
|
|
|
|
|
Exactly what was it that you didn't understand? If I have to explain everything assuming that you know absolutely nothing at all about it, it gets rather long...
---
Year happy = new Year(2007);
|
|
|
|
|
tel me wats wrong in my code,
give me right code
Chohan
|
|
|
|
|
chohanpk wrote: give me right code
It's not that easy. Without a copy of your database, he doesn't know what's wrong. He's told you how to work it out. If you can't work it out, abandon this project, work on something simpler, or at least buy a book and work through it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
chohanpk wrote: tel me wats wrong in my code,
give me right code
I don't see anything wrong in your code. Except of course using Response.Write, but I already explained about that.
---
Year happy = new Year(2007);
|
|
|
|
|
i m using the "northwind" database. n there are matching countries there like USA .
and what is "view source" kindly tel me.
Chohan
|
|
|
|
|
chohanpk wrote: and what is "view source" kindly tel me.
In the View menu in the browser you will find the option Source . That will show you the html code that was sent to the browser.
---
Year happy = new Year(2007);
|
|
|
|
|
Hi
Can any one give me any good link for tutorial of ASP.NET with C#. I am a beginner in this programming world..
Thanks
|
|
|
|
|
Software_Specialist wrote: I am a beginner in this programming world..
If you're a complete beginner, learn C# first, then learn ASP.NET. You should, in either case, buy a book and work through it. That will give you enough knowledge to be able to ask questions here, and understand the answers, and to read online tutorials, which tend to be focused on one subject. You need a basic grounding first, a foundation of general knowledge.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello.
I have a pc with visual studio 2005 working well.
I tried to install VS2003 along with the VS2003 so I can work on an old project built with VS2003 and FW1.1.
The problem is that when I'm tring to create a new asp.net project I'm getting the error:
"The webserver reported the following error when attempting to create or open the web project located at the following URL:'http://localhost/Webapplection1.'.'HTTP/1.1 500 Internal server Error'."
Those are the steps I took to try and solve it:
I checked that IIS is install.
I check that Front page extension is install.
The following FW are listed on my pc:
Microsoft .Net compact framework 1.0 sp3 developer
Microsoft .Net compact framework 2.0
Microsoft .Net framework 1.1
Microsoft .Net compact framework 1.1 HotFix
Microsoft .Net framework 2.0
I run the asp_regiis.exe -i.
Any idea what also should I check?
Is it because I need to install vs2003 first and then vs2005 (Ihope not!).
Thanks in advance,
Roy.
|
|
|
|
|
sdsdsds@hotmail.com wrote: Is it because I need to install vs2003 first and then vs2005 (Ihope not!).
No, if you run regiis, then you register the version of .NET you want to work with . Are you sure this worked ? Is the URL pointing to a web project on your machine ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi Christian,
The regiis worked and run ok.
The VS2005 is still working and there is no problem opening it.
In VS2003 i tried to create a new asp.net project and I got the error you can see in my first post (error 500).
I want the VS2005 to stay like he his and the VS2003 to to work with FW1.1 like he sould.
I have a filling that its an iis problem even due Its working and running.
I'll be glad for any help or idea.
Thanks for your replay.
Roy.
|
|
|
|
|
sdsdsds@hotmail.com wrote: In VS2003 i tried to create a new asp.net project and I got the error you can see in my first post (error 500).
Of course you did. Like I said, IIS can only process one or the other. If .NET 2.0 is registered with IIS, ASp.NET 1.1 isn't going to work, simple as that.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Ok. I Missed understand you.
So, How can I register IIS to work with FW1.1?
I know that on my old pc I had VS2003 and then I installed VS2005 and they are both working together just fine.
Can I register IIS to work only with .NET 1.1? because VS2005 has its own IIS so he doesn't really need the machine IIS? Am I right?
The finel result I need is for both of them to work like I have on My old PC.
Thanks for your post, I hope It will bring me closer to a solution.
Roy.
|
|
|
|
|
sdsdsds@hotmail.com wrote: because VS2005 has its own IIS so he doesn't really need the machine IIS? Am I right?
For development, that is correct.
Run aspnet_regiis.exe with the -i option. It's in the folder under windows that contains the framework.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi Christian,
Good new
I already tried the aspnet_regiis -i and it didn't worked but I finally found a solution.
You can read about it here:
http://codebetter.com/blogs/peter.van.ooijen/archive/2003/11/20/3796.aspx
just do a search on "Adnan Khan" and see his solution.
Thats the only thing that worked.
Thanks a Lot for your help!!!
Roy.
|
|
|
|
|
Christian Graus wrote: Of course you did. Like I said, IIS can only process one or the other. If .NET 2.0 is registered with IIS, ASp.NET 1.1 isn't going to work, simple as that.
Actually, you tell the site which version of the framework you want a particular app to use....IIS Mgr -> Site Properties -> ASP.NET tab -> dropdown list.
I have 2k3 and 2k5 installed on my machine, and both are hunky dory as far as I can tell, although I admittedly only use 2K3 for legacy stuff and not creating new projects. WOrks OK for desktop FW1.1 apps though.
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Hi Richard.
Thanks for your replay.
You can see the solution in my anser to Christian.
Take care,
Roy.
|
|
|
|