|
i already added
using System.Data.SqlClient;
if this is not correct pls kindly describe what i shld do pls
|
|
|
|
|
hi ..
here is some code for connecting to database..
i think this would help you.. make necessary changes..
this is just to show you how we can connect to the db..
put connection string in web.config file
using System;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
public class dbClass
{
private SqlConnection con;
private SqlCommand com;
private SqlDataReader dr;
private SqlDataAdapter da;
private DataSet ds;
public dbClass()
{
con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["conString"].ToString());
}
///
/// Open an Sql connection.
///
/// <returns>sqlconnection
public SqlConnection GetConnection()
{
try
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
}
catch (Exception ex)
{
string err = ex.Message.ToString();
}
return con;
}
///
/// Executes a query with SqlDataAdapter
///
/// <param name="sql" />sql query
/// <returns>DataTable
public DataTable GetAdapter(string sql)
{
try
{
com = new SqlCommand(sql, GetConnection());
com.CommandTimeout = 0;
da = new SqlDataAdapter(com);
ds = new DataSet();
da.Fill(ds);
return ds.Tables[0];
}
finally
{
con.Close();
}
}
|
|
|
|
|
hi
u can see this code and do it
string strCmd="select age from kids where nirc='sss'";
Sqlcommand cmd =new sqlCommand(strCmd,con);
cmd.CommandType=CommandType.Text;
con.open();
DataReader dr=cmd.ExecuteReader();
while(dr.read)
{
// code to populate data
example u want to populate to combo box then u can writecode like this
cmdAge.add.item(dr.GetValues[1]);
}
try with this code i hope u will come out of the problem
tell me confirm once
ok
|
|
|
|
|
actually in my web.config i already have an connection string called
HASDBConnectionString1
what i basically need is ONE value(int) while using the HASDBConnectionString1 connectionstring name in my web.config
my query is queryed by the key column so it always retrun only 1 value
i am using asp.net2 (2005) and sql server 2005
|
|
|
|
|
What is the difference between heap and managed heap.
|
|
|
|
|
A heap is a memory area that a memory manager uses for allocating memory.
The managed heap is the heaps (four of them) that the memory manager in .NET uses to allocate memory for managed objects.
If you allocate unmanaged memory from within .NET, it's allocated from the Windows heap instead of the managed heap. The .NET memory manager allocates memory from the Windows heap to use for the managed heap.
---
single minded; short sighted; long gone;
|
|
|
|
|
How can .net support multiple languages?
plz describe answer for this
|
|
|
|
|
I'm new to the mobile web application development.. I have developed a web application from which a user can select a .cab file to download to the mobile. I just want to know the steps for downloading a particular file to the mobile.Could anybody help me by giving me the proper guidance for the same..
[ I'm using ASP.net 2.0 with C#]
|
|
|
|
|
Hi All,
I need to display Sr No in GridView, in dataset I dont have Sr No column.Please tell me how do I do this...
Thanks in advance...
|
|
|
|
|
two things can be done...
1.Make an Autogenerate column in your Database table if your query doesnt include any JOINING......i.e if you are fetching record from 1 table....
2.If the case is not so...then u have to make 1 column in your DataSet table
....i.e u have to make a customized dataset from your existing dataset.....
Tirtha
Miles to go before I sleep
|
|
|
|
|
Hi Tritha,
Thanks for Reply.First case I cant use because if few rows are deleted then its will show me sr no as 1 2 4 5 etc.
But I think I can use second option.Can u please help me with the code.I am using ASP.NET 2.0(VB) or is there any way we can do it with Query
Thanks...
|
|
|
|
|
Put column in datagrid
--------------------
<asp:TemplateColumn HeaderText ="#">
<HeaderStyle Width="50px" />
<ItemTemplate >
<asp:Label id="Label1" runat="server" Text="<%# sn1() %>">
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
------------------------------------
write in code behind page
public string sn1()
{
int t;
i = i + 1;
t = (grd_category.CurrentPageIndex * pagesize) + i;
return t.ToString();
}
DataGridPageChangedEventArgs e)
{
grd_category.CurrentPageIndex =e.NewPageIndex;
bind();//code to bind the grid
}
hope this would help you..
|
|
|
|
|
I think now u can see it.. else i will send it to you..
|
|
|
|
|
Yes I can see But I am getting error on line
t = (gvExport.CurrentPageIndex * pagesize) + i
Here I cant get CurrentPageIndex.I am using ASP.NET 2.0 (VB)
Please tell me how to do?
|
|
|
|
|
Thanks for the help its working now. I did like this:
On Item DataBound:
If e.Row.RowType = DataControlRowType.DataRow Then
_counter += 1
Dim cntrlabel As Label
cntrlabel = CType(e.Row.FindControl("lblSrNo"), Label)
cntrlabel.Text = _counter.ToString()
cntrlabel.DataBind()
End If
And declare _counter as shared.
Thanks again...
|
|
|
|
|
|
Hi
I have a string and I want to encript it and then decript the encripted result. But with a condition: the encripted result must not contain some given characters.
For example, the given characters is +,&,*,%,^. And I encript a string s1 and attain a string s2, and decript s2 to archieve s1 again. Then, s2 must not contain any one in {+,&,*,%,^}.
Anybody can show me a solution?
Thank you very much.
|
|
|
|
|
Hi,
I was wondering if somebody could tell me how to call a java servlet from an asp.net page and process the value returned from the servlet.
Im working with a servlet that does exactly what I need. Basically I enter one value and it returns another.
I've tried using httpResonse, httpRequest as follows>
*****************************************************
string getVars = "1234567";
HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(string.Format("http://localhost:80/demo1_res{0}",getVars));
WebReq.Method = "GET";
HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
Stream Answer = WebResp.GetResponseStream();
StreamReader _Answer = new StreamReader(Answer);
******************************************************
If I were to run the servlet by its self I enter a number into a text box and press submit. The submit button action is called "demo1_res".
I need a way to call the servlet passing the parameter and execute the method?
But i get this error
"System.Net.WebException: The remote server returned an error: (404) Not Found.
at System.Net.HttpWebRequest.GetResponse()"
Im very new to all of this and im not really too sure how to approach the problem.
Thanks
Dub
|
|
|
|
|
dub_beat wrote: I was wondering if somebody could tell me how to call a java servlet from an asp.net page and process the value returned from the servlet.
I am not sure. But I think you can do it using WebClient class.. Try that
|
|
|
|
|
I have made a webside in asp.net.
I have to use it in full screen ( F11) without scrollbars in the side and button.
But i can't remove them, they always is showen in the side as grey.
My problem is that the web side is showed on a TV screen with information to other people and it looks bad with scrollbars.
I've got applies very much long time consider discover out of how to without luck and the is about to pull hairy nether because of frustration.
|
|
|
|
|
Hi All
Im working on a website with technologies c#,ASP, SQL server,VS 2005.
And i would like to incorporate a music player,can anyone point me in
the right direction with articles/code?
Help would be much appreciated.
Regards
M
|
|
|
|
|
Please refer these sites - http://www.jeroenwijering.com/?item=Flash_MP3_Player
http://www.codeproject.com/useritems/mp3_cms.asp
|
|
|
|
|
Thanks Nicejith, much apprciated.
They will go a long way towards my college project.
Have a nice day
Marie
|
|
|
|
|
We have a textbox within a formview (edit item template), that is within an update panel, that's in a multiview, that's in an update panel (phew).
How can we use the aspx.vb code to edit textboxes.
I'm assuming it's something like:
formview.textbox1.value = "10.00"
I can post more code if needed.
Thanks!
|
|
|
|
|
Hi Friend,
Normally I used conditional way to insert records in database by using "Insert into Tbl_Name etc..." query in c#. I just want to know that Is there any other way to insert or fetch the data to and from the database in Visual Studio 2005 like by using LoginView control or any other control? Please tell me if anyone of you know about it?
Regards,
Abubakar Malik
|
|
|
|