|
Hi, I have written following piece of code on button click event to fill the data in DataGrid in C# Windows application and in ASP.NET web application. I am using SQL 2000.
<br />
string sConnection=@"Data Source=(local)\SOFTSKILLS; Initial Catalog=Northwind; Integrated Security=True";<br />
SqlConnection con = new SqlConnection(sConnection);<br />
con.Open();<br />
string sSQL = "Select * from Employees";<br />
SqlDataAdapter adpt = new SqlDataAdapter(sSQL, con);<br />
DataSet ds = new DataSet();<br />
adpt.Fill(ds);<br />
dataGrid1.DataSource = ds;<br />
con.Close();<br />
The windows application code works but I get errors in ASP.Net webform application.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'machinename\ASPNET'.
Source Error:
Line 59: string sConnection=@"Data Source=(local)\SOFTSKILLS; Initial Catalog=Northwind; Integrated Security=True";
Line 60: SqlConnection con = new SqlConnection(sConnection);
Line 61: con.Open();
Line 62: string sSQL = "Select * from Employees";
Line 63: SqlDataAdapter adpt = new SqlDataAdapter(sSQL, con);
Source File: c:\personal folders\manisha\vs 2003 projects\myprojects\anil\webform1.aspx.cs Line: 61
Stack Trace:
[SqlException: Login failed for user 'ANIL-MANISHA\ASPNET'.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +474
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
System.Data.SqlClient.SqlConnection.Open() +384
Anil.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\personal folders\manisha\vs 2003 projects\myprojects\anil\webform1.aspx.cs:61
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277
Can anyone please suggest me whats going on here?
Thanks.
|
|
|
|
|
|
|
Hi further to my last post, I was trying to resolve this issue and did the following:
SQL Server Enterprise Manager -> Security -> Logins (right click) -> New Login -> Opened a new dialog with number of login options.
Selected "ASPNET... " and clicked yes. Also I added default database as "Northwind".
I hope if someone has this problem, it will help.
Thanks
|
|
|
|
|
username will be 'sa'.try it.and use mixed authontication mode.
hi.
|
|
|
|
|
Hi
I have HTMLInputElement abc whose type is radio, i was using this to check its element whose index is 1.
var abc = document.forms[0].elements[i]; // i is loop variable.
document.forms[0].item(abc.name, 1).checked = true;
it is working in IE but not in FireFox
Is there any way around it?
Regards
Shajeel
|
|
|
|
|
have u mentioned with scripting language u are using, coz in IE the default is "vb script " and in FireFor the default is javascript. Please mention the scripting language
|
|
|
|
|
i m using javascript
Regards
Shajeel
|
|
|
|
|
Hi
I am working on ASP.net application
I want to group the controls selected by the user at run time by javascript (client side code)
If any body know please let me know how to approach for that.
Thanks..
|
|
|
|
|
Hi ,
I have an application in asp .net like the below :
- IIS authentication using Client certificate .
- After successful Authentication in IIS , Form Based Authentication to enter into the application
- The whole application except the Authentication ( Login.aspx, Login.ascx, web.config ) are htm files.
- After succesful login ( Authetication verification ) , the user will be redirected to some other page ( one htm file in a subdirectory).
Issue :
-> How can i have idle timeout implemented in this scenario ?
-> Even if the user is not idle ( doing some processing in htm page ) , after 20 ( timeout in web.config ) minutes the user is being asked to enter Login name and Password !!!
Additional Information :-
In web.config the timeout is set to 20 mins .
I have added the .htm extension ( for the webdirectory ) to be handled by .net framework
Hope some body can help me out .
Thanks in Advance
Guru
|
|
|
|
|
Did anyone know how to import the CSV file into MSSQL database using ASP.net. I'm using the vb script to develope the page. This is urgent.. If anyone know how to solve this problem, please post the sample coding here. Me will appreciate on your help. Thanks..
-- modified at 5:17 Wednesday 5th July, 2006
|
|
|
|
|
Hello All,
How to send values from one page to another in asp.net,
Can any body suggest me how to do the above....
thanks in advance
shree
|
|
|
|
|
There are various ways..Through Session objects,Query Strings ..All depends on your requirement
Check this :
http://msdn2.microsoft.com/en-us/library/50x35554.aspx
|
|
|
|
|
|
|
you can declare those variable as public shared which makes them able to access from one page to another page.
kavitabhat
|
|
|
|
|
Hi all
I am trying to save Database table reslut in EXCEL file
It is working fine but i want to print in another way
--------------------------------------------------------------
Exampel : My program printing like this
--------------------------------------------------------------
Code Month
-----------------
1 Jan
1 Jan
1 Jan
2 Feb
2 Feb
But i want print like this
-----------------------------
Code Month Code Month Code Month
----------------------------------------------------
1 Jan 1 Jan 1 Jan
2 Feb 2 Feb
Means if the Month is same i want to print in same line
I am using this code for saving excel
----------------------------------------
Dim i As Integer
Dim strLine As String, filePath, fileName, fileExcel, link
Dim objFileStream As FileStream
Dim objStreamWriter As StreamWriter
Dim nRandom As Random = New Random(DateTime.Now.Millisecond)
Dim fs As Object, myFile As Object
Dim cnn As OleDbConnection = New OleDbConnection("Provider=SQLOLEDB;server=--;uid=--;pwd=--;database=Northwind")
fileExcel = "WWSS.xls"
If Not Directory.Exists(("c:\WW")) Then
Directory.CreateDirectory(("c:\WW"))
End If
filePath = ("c:\WW")
fileName = filePath & "\" & fileExcel
objFileStream = New FileStream(fileName, FileMode.Append, FileAccess.Write)
objStreamWriter = New StreamWriter(objFileStream)
cnn.Open()
Dim dr As OleDbDataReader ' SqlDataReader
Dim sql As String = "select * from ww "
Dim cmd As OleDbCommand = New OleDbCommand(sql, cnn)
dr = cmd.ExecuteReader()
For i = 0 To dr.FieldCount - 1
strLine = strLine & dr.GetName(i).ToString & Chr(9)
Next
objStreamWriter.WriteLine(strLine)
strLine = ""
While dr.Read()
For i = 0 To dr.FieldCount - 1
strLine = strLine & dr.GetValue(i) & Chr(9)
Next
objStreamWriter.WriteLine(strLine)
strLine = ""
End While
dr.Close()
cnn.Close()
objStreamWriter.Close()
objFileStream.Close()
Is this posible from this code
If not Plz can any one tell me a another way to print
"If the Month is same i want to print in same line "
THX
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
Hi,
I have created an ActiveX dll in MFC. I need it to be installed in client's browser, So that it works in my web page. How could I do that?
Any Help?
Regards
Rams.
Be simple and Be sample.
|
|
|
|
|
Hello Rams
You have to registar in your activex in your tools
then you can access all methods inside the Active X
bye
|
|
|
|
|
Hi Ram,
Need to register in vs.net 2k3 or add in reference vs.net 2k5.
Dasri
|
|
|
|
|
Hai
I have been using Microsoft Application Data Block 2.0 in my ASp.net 1.1 applications . Now we are going to migrate to VS 2005 . Is there any new version / similar applcation block to use with 2005 projects
|
|
|
|
|
|
Hi all,
I am posting this thing second time as i m not able to solve this yet.
I have a dataset and a link(a href). when somebody click on that, the data from the dataset should be downloaded in to the excel file.i m working in sharepoint portal and creating web part using C#.I surf forums, which has the solution for this.But it include creating a class and a method. The thing is that, we dont have any onclick event for HyperLink in ASP.NET. if any solution with javascript, that's good too.If, any body can help me in this problem it would be appreciated.
Thank you very much.
NIKI
|
|
|
|
|
hi,
You can create DTS package for this. DTS package will accept the DS as parameter and fill the sheet. In excel sheet you have to make template with the name range. So, while filling the excel sheet, DTS package refer that name range.
Naishadh Mandaliya
|
|
|
|
|
Hi Naishadh,
Thanks for the quick response.
But, to be very honest, I am new in the sharepoint environment.I know, how to export data to excel in asp.net,but not in sharepoint.If you can give me some details or some type of code, that will be great for me.
Thanks,
NIKI
|
|
|
|