|
Hi,
In web form application,i add a web reference with name dataset.It is generating the 3 files datasetwebsr.disco,datasetwebsr.discomap,datasetwebsr.wsdl.To see the proxy code In ASP.NET express edition there is no show all files option.How to see proxy code.
Please help me.
Thanks in advance
|
|
|
|
|
Hi,
I created a webservice.It has the one web method it returning Dataset like this:
[WebMethod]
public DataSet getauthors()
{
//string constr = "Data Source=(local);Initial Catalog=pubs;User Id=sa;Password=kalpana321";
//SqlConnection con = new SqlConnection(constr);
string constr=System.Configuration.ConfigurationManager.AppSettings[0];
SqlConnection con = new SqlConnection(constr);
SqlDataAdapter da = new SqlDataAdapter("select au_id,au_lname,address from authors", con);
DataSet ds = new DataSet();
da.Fill(ds, "authors");
return ds;
}
when i test this web service it is working fine i.e giving authors details.
I created a new c# Windows application and added the web reference of this web service.
In the page_load
Service c=new Service();
dataGridView1.DataSource = c.getauthors();
when i run this windows forms,the gridview doesnot displaying the authors details.Blank datagridview is displaying.
Why gridview not displaying data.
Please help me.
Thanks in advance.
|
|
|
|
|
dataGridView1.DataBind() FTW.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Hi,
Sorry i did a small mistake.i.e DataGridview1.dataSource=ds,Which is wrong.Correct way is
DataGridview1.dataSource=ds.Tables[0];
|
|
|
|
|
DataGridview1.dataSource=ds will work if you have only one table in the dataset.
But DataGridview1.dataSource=ds.Tables[0]; is correct.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Hi,
Can anyone help me with a problem. I need to display a random image each time a page is loaded. The project is to be created using c# and asp.Net 2.0.
However i need the random image to be displayed from a given directory rather than from url's placed in a database.
If anyone can offer any help i'd really appreciate it. So far ive only managed to find the following code, but this doesnt help as my server does not have the 'FULL' or 'High' trust level required for the server to run this script.
Random r = new Random();<br />
<br />
System.IO.DirectoryInfo d = new System.IO.DirectoryInfo(@"D:\inetpub\communityfoundation\images\leftofpage\");<br />
System.IO.FileInfo[] fi = d.GetFiles();<br />
<br />
int file = r.Next(fi.GetLength(0));<br />
string FIleName = fi[file].FullName;<br />
<br />
Image1.ImageUrl = FIleName;
Thanks!
|
|
|
|
|
That is the code I gave you last time. It is not a script but rather server side C# code. If you put the pictures in a web folder in IIS you should be able to load images from the directory.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Todd,
I know this is code and typed script by mistake.
When i run the code i get an error saying the application doesnt have the correct security level to run this code. Having checked with my hosting company they have confirmed that this is the case, and therefore i can only run code that works at a medium or lower trust level.
Hence ive had to repost to see if you or anyone else can help me work around this.
Thanks.
|
|
|
|
|
Sorry man, the only thing I can think of is to make a webservice and call that from the app or store the images in a database.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Hello,
I have a string with an email address.
I want to look at an Access database to see if there is any record with that email.
If there is a record I want to delete it. If there is no record I want to add a new one with that email address as value in field Email.
I allready have the connection defined in the web.config file.
Could someone tell me how to do this?
Thanks,
Miguel
|
|
|
|
|
SQL
create proc insertEmail
(@email varchar(50)) as
if exsist( select * from dbo.yourTable where
where email = @email )
delete dbo.yourTable where
where email = @email
else
begin
insert into dbo.yourTable
(email) select @email
end
C#
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "YourString";
SqlCommand cmd1 = new SqlCommand();
cmd1.CommandText = "insertEmail";
cmd1.Connection = conn;
cmd1.CommandType = CommandType.StoredProcedure;
cmd1.Parameters.Add(new SqlParameter("@email", stringEmail))
conn.Open();
cmd1.ExecuteNonQuery();
conn.Dispose;
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Hello,
Is it possible to create this using the SQL code in a QueryString in Asp.Net?
It is just I am not used to use SQL procedures and I am not even sure if I can use them in an Access Database.
Thanks,
Miguel
|
|
|
|
|
You can use put a raw sql statement in a string for ADO.NET, but I would highly recommend against putting it in the query string, that would make it viewable to the entire world (and editable). The results would likely be catestrophic.
|
|
|
|
|
I would to suggest...
1) Take Count(*) From your table.
2) If record is greater than 0 then do delete action.
3) Finally U take insert action.
Other way,
1) Never checking the record and take delete action.
2) Finally insert action.
Anyway U can do as u like.
Cheer.
|
|
|
|
|
Hi, i have been going mad for days now, i cant seem to suss this problem out.
I have web.config forms authentication which authenticates normal pages fine.
The problem is when I try to run:
crystalreportviewer.reportsource = "myreportservice.asmx"
it gives me the dreaded "Object moved to here" link, the link then takes me to "myreportservice.asmx".
If i remove forms authentication, the report loads fine.
do i need to pass the logon credentials to the crystalreportviewer object?
I must be missing something very simple.
Please help.
|
|
|
|
|
Hello, everybody! I came to you with another problem. This time, it's about a dataset loading an .xml document and an authentification form: login.
<br />
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)<br />
{<br />
dsLogin ds_login = new dsLogin();<br />
ds_login.ReadXml(Server.MapPath("~/App_Data/login.xml"), System.Data.XmlReadMode.ReadSchema);<br />
Label1.Text = ""; <br />
<br />
for(int i =0; i<ds_login.Tables[0].Rows.Count; i++){<br />
<br />
Label1.Text = Login1.Password + " " + ds_login.Tables[0].Columns[2].Table.Rows[i].ToString(); <br />
if(Login1.UserName == "a") Label1.Text = Label1.Text +" 1 ";<br />
if(Login1.Password == "aaaaaa.") Label1.Text = Label1.Text + " 2 ";<br />
if(ds_login.Tables[0].Columns["UserName"].Table.Rows[i].ToString() == "a") Label1.Text = Label1.Text + " 3 ";<br />
if (ds_login.Tables[0].Columns[2].Table.Rows[i].ToString() == "aaaaaa.") Label1.Text = Label1.Text + " 4 ";<br />
<br />
if(Login1.UserName.Equals(ds_login.Tables[0].Columns["UserName"].Table.Rows[i].ToString()))<br />
<br />
if(Login1.Password.Equals(ds_login.Tables[0].Columns[2].Table.Rows[i].ToString()))<br />
<br />
{<br />
e.Authenticated = true;<br />
} <br />
}<br />
<br />
}<br />
the problem seems to be that the web never reaches the if-s. even thought i've set watches for both values there, nothing happened. more, at the test, i only get 1 and 2 and, instead the value at ds_login.Tables[0].Columns[2].Table.Rows[i].ToString(), i get System.Data.DataRow.
Please tell me what i do wrong!
Thanks in advance!
|
|
|
|
|
Hi,
I know with the "file upload" control you can upload files, but my question is, how can I delete those files, or delete a specific file from my hdd if I know the path, using asp.net?
|
|
|
|
|
System.IO.File.Delete("FilePath");
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Thanks
Just one question. Will "FilePath" be the complete path from "C:\" or from within the application path on IIS or server?
EG http://localhost/invoices/mysheet.doc
|
|
|
|
|
Use the actually file path "C:\"
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
You can use Server.MapPath to translate from the relative path to the absolute.
You may run into permissions exceptions, just a heads up.
~A
|
|
|
|
|
It is true, we have a have web farm so we have two IIS servers running the same site. We can't even write files because the account running aspnet doesn't have access to the network drives. Users can't save files to local drives because it is two machines. After 2 years, I finally came up with a work around. I created a web service that impersonates a windows account and accepts a byte array as a parameter. I call the web service to write files to a networked directory that the impersonated account has access to. I should write an article about it.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Hi all,
I m using asp.net 2.0. I have queried the Database and having all my data in a DataSet (eg 'myDS').
If i ve use GridView control and Bind the DataSet, then the No. of Data Rows displayed in the GridView is same as the No. of Rows in the DataTable of DataSet (myDS).
But i wish to customize the no of GridView Rows, ie Reduce the no of rows. ( Displaying Multiple DataTable Row in a Single Row of GridView.)
For example, the GridView with 3 Columns in a Single row. Each Column Displays respective DataTable Value from myDS. Thereby reducing the no of rows of GridView by 1/3.
Anybody can help me achieve this?
Regards,
Jay
|
|
|
|
|
You can create a new datatable with 1/3 the number of rows. Do something like this.
DataTable dtOriginal = dst.Tables[0];
DataTable dtNew = new DataTable();
DataColumn c1 = new DataColumn();
DataColumn c2 = new DataColumn();
DataColumn c3 = new DataColumn();
string s = "1" ;
c1.ColumnName = "Row1";
c1.DataType = s.GetType();
c2.ColumnName = "Row2";
c2.DataType = s.GetType();
c3.ColumnName = "Row3";
c3.DataType = s.GetType();
dtNew.Columns.Add(c1);
dtNew.Columns.Add(c2);
dtNew.Columns.Add(c3);
int intRowID = 0;
string[] values = new string[3];
foreach (DataRow r in dtOriginal.Rows)
{
switch (intRowID)
{
case 0:
values[0] = r[0].ToString();
intRowID += 1;
break;
case 1:
values[1] = r[1].ToString();
intRowID += 1;
break;
case 2:
values[2] = r[2].ToString();
intRowID = 0;
DataRow rNew = dtNew.NewRow();
rNew[0] = values[0].ToString();
rNew[1] = values[0].ToString();
rNew[2] = values[0].ToString();
dtNew.Rows.Add(rNew);
break;
}
}
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Thanks for your reply. It works fine. But my DataRow contains 4 string values. For that i have used two dimensional Jagged Array and got all the values from first three rows.
For this (Jagged Array values), how can i declare a DataColumn and Bind it to the 4 diff. server controls present in my GridView.
ie. Each Column in the GridView contains 4 no of server cntrols.
I need ur valuable suggestions.. Thanks.
Regards,
Jay
|
|
|
|