|
Check like this :
SqlConnection con = new SqlConnection("Data Source=Ahmadi;Initial Catalog=__Sys__;Persist Security Info=True;User ID=David;Password=500");
con.open();
Does con.Open gives the same error ?
Also you told me that your SQL DataSource does work. Just check its connectionstring as well. Follow the steps :
Go to
View->Server Explorer
Right Click on DataConnections -> add Connection
In the dialog box :
Server Name : Ahmadi<br />
Use SqlServer Autentication, User Name = David, PAssword = 500<br />
Select Database Name : __sys__
Finally click OK.
Now when the node is created, right click on the node and go properties, and check ConnectionString . Use this connectionstring. I think it should be working fine.
|
|
|
|
|
Good Day
Can we see your connection string and show us the name of your sql instance, the name of the SQWl instance we dont mean the name of the computer. When you connect to sql query analyzer there is a part that says Server, post that name and give us the connectionstring and we will point the problem.
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi , ofcourse
connectionstring is :
Data Source=Ahmadi;Initial Catalog=__Sys__;Persist Security Info=True;User ID=David;Password=500")
it works in winform properly . I have Tested it .
|
|
|
|
|
is "__Sys__" the name of your database ?
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I add webservice to my site and write a simple one.
but I can't use this webservice in another pages.
I mean that i don't know how use this service.
for example i want to use webservice on button_click Event.
|
|
|
|
|
Why on earth do you need to use your webservice from your site ? That's just pointless. I think what you may want to use is AJAX, but that's different.
You should probably explain what it is you're trying to achieve. It sounds to me like you need to read a basic book and find out what these things are for, but I could be wrong.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Ha ha ... You are right.
|
|
|
|
|
I have right click on my website in visual studio->add newitem->WebService.asmx
i write a simple translator in Service.cs
but I can't use this service in my website?
|
|
|
|
|
You didn't read my post. You CAN add a webservice, and you can probably use it, it's just a STUPID thing to do. So, the question is, WHY do you want to do this ? What do you think it will help you do ? Once you answer me that, then I can tell you how to do what you want.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I just want to learn that how can I use a websevice.asmx in my website.
|
|
|
|
|
Is your webservice is hosted in another server than your website???
If not then I think it is always better to do the task directly. Web Servers spawns a new thread to every Request made. Thus, if you are calling a web service to get Response, your Web Server will create a new thread and make a request, means an added load to the server to the request.
This way you are actually using Two threads when this could be done in a single one.
Hope you understand our concern.
|
|
|
|
|
I just want to learn thay how can I use a websevice.asmx in my website.
I right click on my website and Addwebrefrence and i browse to "Web services in this solution "
and find in URL column "service.asmx".I write "service.asmx" in URL (in address bar )but didn't accept?
what shoud i do?
I have two textbox in one of my page and user shoud fill one of them and press button.
now on cick_button Event i shoud get this text and use my webservice(my webservice is translator)to translate this word.
I should send textbox1.text to my webservice and webservice return a string that i should put it in textbox2.text;
|
|
|
|
|
The problem is that it is idiotic to use a webservice hosted on the same server. If you want to learn how to use webservices, find an external one that you can connect to. I suspect your issue is that your webservice is not running, because when you add a reference, your site is not running.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
i didn't undrestand that you said "find an external one that you can connect to"?
and what should i do for the next problem that you said?"I suspect your issue is that your webservice is not running, because when you add a reference, your site is not running"
|
|
|
|
|
I think you need to go back to reading a very basic book. I'm sorry, I can't explain it much simpler than that.
Webservices exist to provide an interface to an external client. There's plenty you can find and connect to from your site. As your website has access to your code already, there is no use in writing a webservice that connects to the same site. A webservice is not running if it's not on a live server. Your server only runs when you debug the site. So it does not exist when you try to connect to it.
You've got everything wrong and everything backwards. Start simpler. Read more. Try to understand what it is you are doing.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
farokhian wrote: I just want to learn thay how can I use a websevice.asmx in my website.
Here you go
using web service in asp.net[^]
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
why dont you use :
http://msdn.microsoft.com/en-us/library/8wbhsy70(VS.80).aspx[^]
You will find step by step tutorial here.
farokhian wrote: I right click on my website and Addwebrefrence and i browse to "Web services in this solution "
and find in URL column "service.asmx".I write "service.asmx" in URL (in address bar )but didn't accept?
You need to mention WebReference Name.. which you later use as your main Class for calling the web methods.
|
|
|
|
|
|
I need to implement the following:
I have datatable, from which a dataset is created by selecting all rows. after sorting the dataset based on one column, then I want to get first 5 rows and create a new dataset with the top 5 rows, how to do?
I have tried several methods, not successful.
thanks for any hint.
|
|
|
|
|
First of all, let me clear your concept about DataSet, DataTable and DataRow.
1. DataSet ( It is a collection of DataTables)
2. DataTable (It is a collection of DataRow)
3. DataRow (It is a collection of Data Elements)
Well, Now if you have a datatable, you cant create a DataSet from it... as basically it is already a part of a dataset. If you are talking about coping some rows from one DataTable to a new DataTable, this can be done. Just I am going to create an example for you below :
DataTable dtNew = dt.Clone();
var dataSelect = (from r in dt.AsEnumerable()
orderby r[0]
select r).Take(5);
foreach (DataRow dr in dataSelect)
{
DataRow newRow = dtNew.NewRow();
for(int i=0; i<dr.Table.Columns.Count; i++)
newRow[dr.Table.Columns[i] = dr.Table.Columns[i];
}
After the foreach loop the DAtaTable dtNew will hold only the 5 elements selected in dataSelect.
Hope you got the point. Just mold this into your requirement.
Cheers
|
|
|
|
|
thanks, but .take can be used for ADO.net?
|
|
|
|
|
yes.. Actually Take comes as Extension Function to all Enumerable objects. You can use them easily.
Only thing is to add System.Linq namespace to your project. The Static class Enumerable defines all those Extension Methods to IEnumerable objects.
Cheers..
|
|
|
|
|
Hello
I want to put some downloadable files on my website. Should I use hyperlink on my pages or there is a better way?
Thanks a lot
|
|
|
|
|
If you have the physical files on the server than a hyperlink is the quick and best solution.
Another option is to store/upload the files in database and than stream them to the client.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Well... If the folder that contains the files is within your virtual directory path then you can use it directly.
But remember, This means you are going to open the link for everyone.. Anyone who doesnt have login even can download the file.
Rather than doing so, I like to have files in a secured folder (Say D:\secret) where my website is running in another path(say C:\MyWebSite), or rather files are in another file server which is within the same network say (\\server2\files)
Now when the user clicks on a link, the Onclick Event handler will transmit the file to the client using
Response.TransmitFile() .
|
|
|
|