I'm using MySql in my asp.net project. But I don't want to type every "using MySql.Data.MySqlClient;" statement in every aspx.cs/aspx.vb file. How can I define this lines in web.config file?
I've defined some namespaces like below but this only works for aspx pages:
I'm using the 'Configure Data Source' wizard to connect to my database and show the dataset in Gridview. I want to be able to update, insert and delete entries but am unsure how to build the query. I can write simple update statments to change database entries but how can I do this for entries that have been changed within the gridview?
I am new to asp.net and wondering if anybody can help me defining SQL Server 2005 ConnectionString in web.config file and call/read anywhere in application on any button.Kindly provide me code example.
The httpRuntime element configures ASP.NET HTTP run-time settings that determine how a request for an ASP.NET application is processed.
Is it a good idea to customize this element in the config file.
The user has indicated that the application seems to be kicking her out, even though she is sure that she is submitting a form faster than every 30 minutes.
My Config file has these vales set, am I missing anything?
string sqlstring = "SELECT DISTINCT STAFF_ID, SCHOOL_CODE FROM MODULE_TIMETABLE_STAFF WHERE STAFF_ID != '" +userId + "' AND STAFF_ID LIKE '%" + Searcht + "%' ORDER BY STAFF_ID ASC";
can anyone explain this statement for me? especiallythese signs !=,+ +
I want to add Sum contents from the two tables, Realize the rows could be different, Only like rows to be added rest of the rows from both tables are listed.
SELECT TYPE AS CashFlow, Sum(AceData.InCredit) AS Credit, Sum(AceData.OutDebit) AS Debit, Sum([InCredit]+[OutDebit]) AS Totals FROM AceData where case=1 GROUP BY Type; CashFlow Credit Debit Totals Advert $0.00 ($5,816.52) ($5,816.52) BOND $0.00 ($3,060.00) ($3,060.00) Cash $18,619.57 ($34,824.75) ($16,205.18) Charity $0.00 ($6,578.00) ($6,578.00) DayCare $0.00 ($2,360.00) ($2,360.00) SELECT TYPE AS CashFlow, Sum(AceData.InCredit) AS Credit, Sum(AceData.OutDebit) AS Debit, Sum([InCredit]+[OutDebit]) AS Totals FROM AceData where case=2 GROUP BY Type; CashFlow Credit Debit Totals BOND $0.00 ($3,060.00) ($3,060.00) Cash $18,619.57 ($34,824.75) ($16,205.18) Charity $0.00 ($6,578.00) ($6,578.00) DayCare $0.00 ($2,360.00) ($2,360.00) Entertainmen $0.00 ($12,258.18) ($12,258.18) Equipment $0.00 ($7,085.00) ($7,085.00) Fee $1,957.63 ($27,611.85) ($25,654.22)
How can I schedule several statements that involve select ... into ..., delete, and exec one other stored proc, periodically? For instance, every 6 hours, in Sql server DB
how to join 2 sql select statements in Oracle, which has different number of rows. That is I have first select statement which fetchs around 80 records in below format.
Second statement will give reocrds like below. That is it will give only distinct dates. Please tell me how to join these two queries. So that I can get
DATE Rank 12-01-2010 a 12-02-2010 b 12-03-2010 c
how to join these two queries. So that I can get result set in below format.
DATE MONEY Rank 12-01-2010 10 a 12-01-2010 15 a 12-01-2010 15 a 12-02-2010 15 b 12-02-2010 15 b 12-03-2010 15 c 12-03-2010 15 c
I've got a repeater on my asp.net (VB): <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("Question_Number") %>' /> <%#Eval("Question_Desc")%>
Now what I want to do is, check a value that I haven't used called "Question_Type" which could be = 1, 2 or 3 depending if it is multiple choice, short answer, etc. I have tried this:
<% if Eval("Question_type") = 1 then Response.Write(" <asp:RadioButton runat=""server"">test1</asp:RadioButton>") Response.Write(" <asp:RadioButton runat=""server"">test2</asp:RadioButton>") Response.Write(" <asp:RadioButton runat=""server"">test3</asp:RadioButton>") end if %>
and I get this error: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. HOW can I use this value in a if statement?
I have a ListView with many advanced controls and html tags. ListView is bound to collection of profiles when first profile in collection is current profile. current profile has few differences from other profiles ie. flash embed, js and some other stuff. I can access inside of my ListView Container.DataIndex property which gives me 0 as first item in index but i'm unable to use inline If statements like so
<% If Container.DataIndex = 0 Then %> do stuff <% EndIf %>
this is because i must place pound to access databound item but neither this
<%# If Container.DataIndex = 0 Then %> do stuff <% EndIf %>
The @( ) syntax enables a code block to have multiple tokens. For example, we could re-write the above code to concatenate a string and the number together within a @( code ) block
I have a BasePage class that all of my content pages inherit from. In my BasePage, I have many Import Statements. It seems as though they carry over into the derived class as one would expect. However, if you were to try and access code in the client aspx design page, as you would in the code-behind, you run into problems.
For instance, in my BasePage i have a Public Enum named ThemedSites. It's just an enumerator that lists the 5 different themes my site could be skinned as. I, at times, need to do different things in code, and in design, depending on what theme I'm currently in. I have a Public Property named CurrentSite (might have been more appropriate to say CurrentTheme, but that's besides the point). CurrentSite's return type is ThemedSites. So in code, one would say something like:
[Code]....
This works great in any page that inherits the BasePage class. This falters when that very same logic is used in the design page like:
[Code]....
Now, it works if you fully qualify both sides of the condition, but that's not my question. My question is: why isn't the Imported NameSpace in the BasePage recognized in the client-side server tag, as one would think it would be, according to how it IS recognized in the server-side code-behind?
I am facing an intresting problem now with entity framework. if i did a count of the some table with linq statement its give some count and it is not matching with my normal sql query count. my sql query returning count of all the records in that table where as linq query returns some count which is less than sql count. is this a problem with my edmx or table navigation properties..i do have some 5 to 6 child tables inside this table with foreignkey relation. will it do a join on each child table and returns only those records. I am very much confused and don't know how to slove this.
Is there any design pattern or architectural design that prevent the following type of code, where I have an enum with different fileformats and I have to make a switch anywhere I want to distinguish between the different fileformats?
[Code]....
If add an item to the enum definition in this case I have to change all the code that uses switches and that kind og enum which, I guess, is a bad approach in terms on maintenance of the application?
I have an ASP.NET GridView which displays a list of neighborhoods.
I wish a user (administrator) to be able to edit the neighborhood name.
Now, the database is quite complex, and as such, i can't simply provide an UpdateCommand / SqlDataSource for the GridView.
I bind the data manually (on first load, and on the PageIndexChanging event).
Binding/listing paged data is working fine.
However, i'm having trouble trying to UPDATE the data.
The user clicks the "Edit" button, the textbox for the neighborhood name is shown, i change the text, click "Update", but the RowUpdating event is not firing.
I basically want to grab the row that was edited, and perform a custom update using LINQ.
Is this not possible with a GridView? If it's not, what are my alternatives? A repeater with LinkButtons and a hidden textbox that can swap in/out the labels?
vote-up@{puzzle.UserVote .... is not treating the @ symbol as a start of a code block @puzzle.UserVote == VoteType.Up looks at the first part @puzzle.UserVote as if it's supposed to render the value of the variable.
I know how to do this with 1 declare statement, but for this there are multiple one's. This example sql statement has 2, however my actual one will have 29.