|
This is not the place for this sort of rant. Either use the Lounge[^], or one of Microsoft's own websites.
Veni, vidi, abiit domum
|
|
|
|
|
how to split an excel workbook into two when it exceeds 600 kb in c#.net
|
|
|
|
|
|
hello frnds , iam new to the CMS. show me the sample example
Mr.VJ
|
|
|
|
|
Not a specific question but this[^] could have help you.
thatrajaNobody remains a virgin, Life screws everyone
|
|
|
|
|
1 - i make text box with auto complicate extended
2- i pot my connection string
"
<connectionStrings>
<add name="conn" connectionString="Data Source=.;Initial Catalog=Tranning;Integrated Security=True" providerName="System.Data.SqlClient"/>
<add name="tempdbConn" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\tempdb.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
"
and i make method
[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public static List<string> SearchCustomers(string prefixText, int count)
{
using (SqlConnection conn = new SqlConnection())
{
conn.ConnectionString = ConfigurationManager
.ConnectionStrings["conn"].ConnectionString;
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "select No_Trainee from Annual_Plan where No_Trainee like @SearchText + '%' ";
cmd.Parameters.AddWithValue("@SearchText", prefixText);
cmd.Connection = conn;
conn.Open();
List<string> customers = new List<string>();
using (SqlDataReader sdr = cmd.ExecuteReader())
{
while (sdr.Read())
{
customers.Add(sdr["No_Trainee"].ToString());
}
}
conn.Close();
return customers;
}
}
}
and still my text Box not get values from database
Please need help !!!
|
|
|
|
|
1. Is your SearchCustomers method called at all?
2. What auto-complete do you use? JQuery one?
3. How is your text box set up to use it?
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
Hi, the asp.net identity use entity framework native
Any suggestion for override controls?
Example?
Pls
|
|
|
|
|
I'm having a problem reading data from a view built in a sql server db. I'm trying to use the same code to read from the view as I have used to read from sql server tables in the past through vb.net/asp, but it is not working. Vbcode bombs on the "sqlRead = sqlCmd.ExecuteReader()" line.
ASP
[code]
<pre lang="xml"><%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" namespace="System.Web.UI.WebControls" tagprefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Lifepoint Dashboard</title>
<style type="text/css">
#form1
{
height: 452px;
width: 856px;
}
#frmLPNT
{
height: 565px;
}
</style>
</head>
<body>
<form id="frmLPNT" runat="server">
<div>
</div>
<asp:Image ID="Image1" runat="server" Height="90px"
ImageUrl="~/images/IT&SLogo.jpg" Width="90px" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<br />
<asp:SqlDataSource ID="dsLPNT" runat="server"
SelectCommand="SELECT [Incident_Number], [COID],[Vendor_Ticket_Number] , [Status], [Status_Reason],
[Priority], [Owner_Group], [Owner], [Assigned_Group], [Assignee],
[Product_Name], [First_Name], [Last_Name]
FROM [hca_incident_view]
WHERE (([Status] = 'In Progress') AND ([Company] = 'LifePoint') AND ([COID] = @COID))"
ConnectionString="<%$ ConnectionStrings:RemedyConnection %>"
DeleteCommand=""
InsertCommand=""
UpdateCommand="">
<SelectParameters>
<asp:ControlParameter ControlID="ddlCOID" Name="COID" PropertyName="Text" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<br />
<asp:DropDownList ID="ddlCOID" runat="server" onSelectedIndexChanged="ddlCOID_SelectedIndexChanged" AutoPostBack="true" Height="22px" Width="331px">
</asp:DropDownList>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333"
GridLines="None">
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<div style="margin-left: 280px">
<br />
</div>
</form>
</body>
</html></pre>
[/code]
VB.net
[code]
<pre lang="vb">Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlClient
Imports System.Data.DataRowView
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub frmLPNT_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles frmLPNT.Load
Me.ddlCOID.Items.Add("Select LifePoint Facility...")
Me.ddlCOID.Items.Add("Acadian Regional Medical Center")
Me.ddlCOID.Items.Add("Ashley Valley Medical Center")
Me.ddlCOID.Items.Add("Ashley Valley Medical Center")
Me.ddlCOID.Items.Add("Bolivar Medical Center")
Me.ddlCOID.Items.Add("Colorado Plains Medical Center")
Me.ddlCOID.Items.Add("Ennis Regional Medical Center")
Me.ddlCOID.Items.Add("Valley View Medical Center")
Me.ddlCOID.Items.Add("Lake Havasu Regional Medical Center")
Me.ddlCOID.Items.Add("Memorial Medical Center Resources")
Me.ddlCOID.Items.Add("Los Alamos Medical Center")
Me.ddlCOID.Items.Add("Memorial Hospital of Martinsville")
Me.ddlCOID.Items.Add("Minden Medical Center")
Me.ddlCOID.Items.Add("Northeastern Nevada Regional")
Me.ddlCOID.Items.Add("Palestine Regional Medical Center")
Me.ddlCOID.Items.Add("Parkview Regional Hospital")
Me.ddlCOID.Items.Add("LPNT CORP")
End Sub
Public Sub ddlCOID_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlCOID.SelectedIndexChanged
Dim strCOID As String = TryCast(sender, DropDownList).SelectedValue
Select Case strCOID
Case "Acadian Regional Medical Center"
strCOID = "02751"
Case "Andalusia Regiona Hospital"
strCOID = "05356"
Case "Ashley Valley Medical Center"
strCOID = "05424"
Case "Bolivar Medical Center"
strCOID = "02723"
Case "Colorado Plains Medical Center"
strCOID = "02740"
Case "Ennis Regional Medical Center"
strCOID = "02750"
Case "Valley View Medical Center"
strCOID = "02757"
Case "Lake Havasu Regional Medical Center"
strCOID = "02758"
Case "Memorial Medical Center Resources"
strCOID = "02765"
Case "Los Alamos Medical Center"
strCOID = "02779"
Case "Memorial Hospital of Martinsville"
strCOID = "02781"
Case "Minden Medical Center"
strCOID = "02782"
Case "Northeastern Nevada Regional"
strCOID = "02784"
Case "Palestine Regional Medical Center"
strCOID = "02785"
Case "Parkview Regional Hospital"
strCOID = "02790"
Case "LPNT CORP"
strCOID = "05433"
End Select
'MsgBox(strCOID)
Dim sqlConn As New SqlConnection(ConfigurationManager.ConnectionStrings("RemedyConnection").ConnectionString)
Dim sSql As System.Xml.Linq.XElement = <sql> SELECT [Incident_Number], [COID],[Vendor_Ticket_Number] , [Status], [Status_Reason],[Priority], [Owner_Group], [Owner], [Assigned_Group], [Assignee], [Product_Name], [First_Name], [Last_Name] FROM ([hca_incident_view]) WHERE ([Status] = 'In Progress') AND ([Company] = 'LifePoint') AND ([COID] = '<%= strCOID %>')
</sql>
'This code executes your sql command
Dim sqlCmd As New SqlCommand(sSql.Value, sqlConn)
Dim sqlRead As SqlDataReader
If sqlConn.State <> ConnectionState.Open Then
sqlConn.Open()
End If
sqlRead = sqlCmd.ExecuteReader()
sqlRead.Read()
sqlRead.Close()
'MsgBox("Connected")
'Close the connection
sqlConn.Close()
For i As Int16 = 0 To Me.ddlCOID.Items.Count - 2
For j As Int16 = Me.ddlCOID.Items.Count - 1 To i + 1 Step -1
If Me.ddlCOID.Items(i).ToString = Me.ddlCOID.Items(j).ToString Then
Me.ddlCOID.Items.RemoveAt(j)
End If
Next
Next
End Sub
End Class</pre>
[/code]
|
|
|
|
|
Firstly, your post is extremely hard to read, since you haven't formatted your code. Please edit your post and use the code button on the editor toolbar to format your code blocks.
Secondly, you're building a dynamic query, which could leave your code open to SQL Injection[^]. In this case, since you're using hard-coded strings, nothing bad will happen. However, if you forget and later modify the query to include input which is under the user's control, this will become a serious problem. Get into the habit of using parameterized queries even when you're sure that they can't be exploited.
You're executing the query, but you're never actually using the data it returns. You simply call .Read and then close the connection. You need to read the data from the SqlDataReader and do something with it.
You should wrap the SqlConnection , SqlCommand and SqlDataReader variables in a Using block[^], to ensure that they are cleaned up even if the code throws an exception.
Finally, you need to post the details of the exception that's thrown. Saying "the code bombs" isn't enough for anyone to diagnose the problem!
Dim sSql As String = "SELECT [Incident_Number], [COID], [Vendor_Ticket_Number], [Status], [Status_Reason], [Priority], [Owner_Group], [Owner], [Assigned_Group], [Assignee], [Product_Name], [First_Name], [Last_Name] FROM [hca_incident_view] WHERE [Status] = 'In Progress' AND [Company] = 'LifePoint' AND [COID] = @COID"
Using sqlConn As New SqlConnection(ConfigurationManager.ConnectionStrings("RemedyConnection").ConnectionString)
Using sqlCmd As New SqlCommand(sSql, sqlConn)
sqlCmd.Parameters.AddWithValue("@COID", strCOID)
sqlConn.Open()
Using sqlRead As SqlDataReader = sqlCmd.ExecuteReader()
While sqlRead.Read()
' TODO: Do something with the data here...
End While
End Using
End Using
End Using
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That worked perfectly. Not sure why my other method didnt work because it worked with another database I use. Anyways...many thanks!
|
|
|
|
|
Hi Friends... I am developing Video Websites..
I wants to secure the flv files from downloading and encryting source code parameter value (value="flv=videos/conversation/intro.flv) from viewing by right click..
My code below
<object type="application/x-shockwave-flash" data="videos/player_flv_mini.swf" width="426" height="240">
<param name="movie" value="videos/player_flv_mini.swf" />
<param name="allowFullScreen" value="true" />
<param name="sharedSecret" />
<param name="FlashVars" enableviewstate="false" value="flv=videos/conversation/intro.flv&autoplay=1&width=426&height=240&playercolor=5f9906&loadingcolor=ff5c29&buttoncolor=fcfcfa&slidercolor=fcfcfa" />
</object>
I want to hide
value="flv=videos/conversation/intro.flv this to this like value="jhgdb chud jgcdb vcagsb avbhvbsdhv"
Please anyone can help me out..
send the code behind....
|
|
|
|
|
Hi Friends,
I have gridview with 2 columns "Tower" - dropdown template field and "Country" - dropdown template field.
I have datatable with 2 columns Tower and Country and has 100 rows.
Now my need is to attach this datatable to gridview, but i should not get 100 rows in gridview, i should get only one row, where Tower and Country dropdown should contain all 100 rows data as Listitem respectively.
(i.e.,) Gridview should contain only one row with 100 items in each column dropdown.
Please help in this, I am stuck in this.
Regards,
Priyaa.
|
|
|
|
|
i have used a stored procedure which requires joining with 10 tables (can't reduce this). It takes 8 seconds to load the page with this procedure. Also i have 2 more procedures with simple select queries for validation.
Can i increase the performance by using linq or anyother methods instead of using this procedures. please help me out .
|
|
|
|
|
|
Is it SQL Server database ? If yes have checked Execution Plan of store procedure and other queris.
Thanks and Regards,
Arif.
Life Is Beautiful
|
|
|
|
|
You need to start by measuring where the performance problem is.
- Is the query slow to execute from SSMS?
- Does it take a long time for ASP.NET to read the results of the query?
- Is ASP.NET taking a long time to bind the data and build the control hierarchy?
- If the generated output is large, is it taking a long time to download to the browser?
- If the generated output is very large, is it taking a long time for the browser to render it?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi All,
I have a secure webservice which I want to call using jquery.The webservice require credentails to conneccto to it. I know how to call webservice which is not secure.Can any one please help me for this.
Thanks,
Arif
Life Is Beautiful
|
|
|
|
|
I know there is tons on the web about things like remote powershell and UserPrincipal/PrincipalContext being slow but I cannot seem to find the answer to the problem
Basically my login page authenticates the user against active directory. I am experiencing anywhere between 1-2 minutes on the first try. Each try after that seems to be faster.
What I am doing on authentication is this:
* I use PrincipalContext and call ValidateCredentials
* Using the same PrincipalContext I call UserPrincipal.FindByIdentity (using UserPrincipalName)
* I get the groups the user belongs to and send back to the calling method (using .GetGroups())
* I then create the forms authentication ticket and call Response.Redirect if the user authenticated
Is there a better way to achieve this upon login? I need to be able to authenticate the user and get the user's groups when they login.
|
|
|
|
|
Hey friends...I am creating an online examination project...I have made the login...the admin part and even all the databse thing is done...but in the user side as i press the start exam button it givving "Object reference not set to an instance of an object. " error...please help me out ASAP...m about to meet the deadlines..and if i meet it i ll be dead...
here's my code..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Instruction : System.Web.UI.Page
{
OnlineExamsDataContext _mycontext = new OnlineExamsDataContext();
string username;
protected void Page_Load(object sender, EventArgs e)
{
username = Request.QueryString["username"].ToString();
lbluname.Text = "Welcome :" + username;
lbldate.Text = System.DateTime.Now.ToString();
}
protected void btnstart_Click(object sender, EventArgs e)
{
int emailid;
emailid = _mycontext.ExamTableInsert (Convert.ToDateTime (System.DateTime.Now.ToShortDateString()), Convert.ToInt32 (Request.QueryString["UserID"].ToString()), Convert.ToDecimal("0.0"));
Response.Redirect("QuestionPaper.aspx");
}
protected void lbtnresult_Click(object sender, EventArgs e)
{
Response.Redirect("Examresult.aspx");
}
}
|
|
|
|
|
it says Object reference not set to an instance of an object. is in the line which i have underlined....:'(
|
|
|
|
|
Hey,
Make sure your query string "username" exists.
You are getting this error because you are trying to convert the a query string that is null to a string.
best is to add an if statement:
if (Request.QueryString["username"] != null) {
username = Request.QueryString["username"].ToString();
lbluname.Text = "Welcome :" + username;
lbldate.Text = System.DateTime.Now.ToString();
} else {
}
|
|
|
|
|
It is always best practice to convert object with Convert.ToString(Request.QueryString["username"]) instead of .ToString().Check whether you are getting username value as null.
Life Is Beautiful
|
|
|
|
|
Since Request.QueryString[key] already returns a string , there's absolutely no need to call either Convert.ToString or .ToString() to convert it to a string.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Just drop the .ToString() call - Request.QueryString["username"] already returns a string .
username = Request.QueryString["username"];
You also need to HTML-encode the value before you display it, to avoid cross-site scripting (XSS)[^]:
lbluname.Text = "Welcome :" + HttpUtility.HtmlEncode(username)
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|