|
You get it like this:
LoginControl1.UserName.Trim();
|
|
|
|
|
I followed the article here http://www.kirupa.com/net/sql_asp_introduction.htm
everything compiles ok but when it get to opening the database I get error message
An attempt to attach an auto-named database for file C:\Path\Games.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share
I do not have any other databases with the same name and it is on the C drive so leads me to believe for some reason it can not open the database.
could someone please help me with this.
Thanks
|
|
|
|
|
|
ok i figured out what was wrong, .net 2.0 needed to be reinstalled, my app now runs but does not write to the database, is there something wrong with my code to write to the database?
SqlConnection connection;
protected void Page_Load(object sender, EventArgs e)
{
connection = new SqlConnection(ConfigurationManager.ConnectionStrings["GameConnection"].ConnectionString);
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
SqlCommand command = new SqlCommand("INSERT INTO gameTable(gameName, gamePlatform) VALUES (@id_gameName,@id_gmaePlatform)", connection);
SqlParameter nameContent = new SqlParameter("@id_gameName", SqlDbType.VarChar);
nameContent.Value = txtName.Text;
command.Parameters.Add(nameContent);
SqlParameter platformContent = new SqlParameter("@id_gamePlatform", SqlDbType.VarChar);
platformContent.Value = txtPlatform.Text;
command.Parameters.Add(platformContent);
connection.Open();
command.BeginExecuteNonQuery();
connection.Close();
Response.Redirect("Results.aspx");
}
|
|
|
|
|
Planker wrote: command.BeginExecuteNonQuery();
connection.Close();
You make an asynchronous call to insert data, but you close the connection right after that then how data can be inserted into DB. You might also double check the parameter name gmaePlatform as well.
|
|
|
|
|
I have a GridView that displays rows of pictures along with text that describes the pictures. When I click on the picture I would like another page to display. How do I write an event for that, or can I configure the Imagefield in the GridView to do this? Thanks.
|
|
|
|
|
AFAIK, the ImageField does not allow you to define the event handler in the field markup, instead you'll need to use the RowCreated/RowDataBound event of the GridView control and try to get reference to the Image control, then register your event handler script. Another option is to use the Image control with the TemplateField in lieu of the ImageField and you can easily add the event handler for the Image control in the template.
|
|
|
|
|
You shouldn't need any event handlers, a template field with an image link will do the trick.
|
|
|
|
|
hi friends
i want display the current date in textbox.how can i bind the date with c#,asp.net
plz give me the code
regards
saravanan
|
|
|
|
|
SomeTextBoxThatYouHave.Text = DateTime.Now.ToString("d", TheFormatInfoOrCultureInfoThatYouWantToUse);
---
Year happy = new Year(2007);
|
|
|
|
|
hi
thanks for reply
i want currentdate only.i dont want time.date is dd/MM/yyyy this format
regards
saravanan
|
|
|
|
|
You can't get only a date. The DateTime structure is used to handle dates and times, and there is no Date structure wihtout time. The time is always there, even if it's 0:00, it's still there. It's no problem, though, as you choose what you want to display when you convert the DateTime value to a string.
The formatting string that you use in the call to ToString determines the format. The "d" string specifies the use of a short date format. The short date format is depending on the culture, so you should specify a FormatInfo or CultureInfo object to determine the culture to be used.
---
Year happy = new Year(2007);
|
|
|
|
|
Try like this,
sometextbox.Text = Now.ToString("dd/MM/yyyy")
|
|
|
|
|
If you call DateTime.Now.ToShortDateString(), you will get a string that is locale correct.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Is there any way to handle event(maybe some custom) raised by ASP.NET page in outer application(of course in .NET platform)? I am running Windows Form and start ASP.NET server from form. And data received from web should be processed in form too.
|
|
|
|
|
I believe that there are a couple of options to notify the Windows Form ( or an outer .Net application in general), for example .Net remoting, MSMQ, ....
|
|
|
|
|
I believe this too;) But would be great to know HOW should I do
|
|
|
|
|
Assuming you use the .Net Remoting, briefly your Window application can host an object that can be called remotely from an outer application like the ASP.NET application. Whenever a custom event happens in the ASP.NET application, you can send a request from the ASP.NET application to notify the Windows application via this remote object about this event as well as the event-related data sent along with the request. For more information, sample code, and how-tos you can see Remote Objects[^]
|
|
|
|
|
Thanx for this - remoting is quite usable. But maybe there is a way to pass objects inside system? I mean that would be great if objects will not be able to come out from local machine .NET system.
|
|
|
|
|
|
|
I'm trying to use TabPanels inside of a TabContainer. Each of the TabPanels contains an iFrame with src specified. The problem I'm having...The panels will not adjust in size according to the content and content is not being displayed. If I don't use frames and simply place all markup/content within the <contenttemplate> tags, the panels' size adjusts to accomodate. Is there a trick to getting the TabPanels to work with iFrame?
<cc1:tabcontainer runat="server" id="Tabs" onclientactivetabchanged="ActiveTabChanged">
<cc1:tabpanel runat="Server" id="Panel1" headertext=" Page1 ">
<contenttemplate>
<cc1:tabpanel runat="Server" id="Panel2" headertext=" Page2 ">
<contenttemplate>
<cc1:tabpanel runat="Server" id="Panel3" headertext=" Page3 ">
<contenttemplate>
lawsop
|
|
|
|
|
hi,
i have sqlserver express set up on my machine and i am using the default AspNetSqlMembershipProvider provided by .Net 2.0. and my application uses forms authentication
I started out with a CreateUserWizard. when i run my application aspnetdb.mdf is created in App_data folder and my CreateUserWizard says that the user has been added.
But the problem is
1) when i try to open the database thru my database explorer (Visual studio 2005) it says "Failed to generate a user instance of SQL Server due to failure in the starting process for the user intance. The connection will be closed"
2) Also when i try using SqlServerManagement studio i can't see any database called aspnetdb when i connect to my SqlServerExpress. however i can see that aspnetdb.mdf is being created in my App_data folder.
my machine.config has this
<membership>
<providers>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
</providers>
</membership>
<connectionStrings>
<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
</connectionStrings>
my web.config file has forms authentication
<authentication mode="Forms">
<forms name=".ASPXAUTH" loginUrl="Login.aspx" protection="All" timeout= "30" path="/" requireSSL="false" slidingExpiration="true" cookieless= "UseDeviceProfile" />
</authentication>
can somebody help me
thanks
yojimbo
|
|
|
|
|
If you want to open the database with SQL Management Studio Express you need to right click on the Database folder and click attach and browse to your DB in the App_data Dir in your current project then you will be able to see it in SQL MSE .
|
|
|
|
|
Hi,
I want to pass some values to the webservice writern in C# from my ASP page.
In the ASP page, I am using the Yahoo UI functions to make a webservice call like this
Append("oACDS = new YAHOO.widget.DS_XHR(\"AC1.aspx\", [\"Table\", \"Order\"]);\n");
....
Response.Write(Copy());
I am able to get the value keyed into the text box ... I am using this call in the webservice
string query = Request.QueryString["query"];
So similarly I want to pass more values from the asp page to webservice, can anybody pls let me know how can i do this?
Thanks in advance
|
|
|
|