|
I'm not very sure that I got you..
maybe. you can try like that..
<img src="Images/sliderbuttonoff.png" id="zoom0" onmouseout="javascript:this.src='Images/sliderbuttonoff.png';" onmouseover="javascript:this.src='Images/northover.png';" class="buttonBarButton0" alt="demo" />
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Looks like it was removed for you.
Brad
Australian
- Christian Graus on "Best books for VBscript"
A big thick one, so you can whack yourself on the head with it.
|
|
|
|
|
How do I connect to a SQL SERVER 2005 DSN Using ASP? I have not done this in awhile (mainly Administration) and Having problems.
|
|
|
|
|
|
I am trying to export some data to an excel spreadsheet by passing variables to it. I keep getting a blank page. My code looks like this:
On the first page where I pull the data from the database I have this link:
target="_blank" href="DocAttach_Summary_Excel.asp?HMO=<%=request.form("HMO")%>">Export to Excel
My export to excel page looks like this:
<%
Response.ContentType = "application/vnd.ms-excel"
%>
<% set objconn=server.createobject("adodb.connection")
connpath="DBQ=" & server.mappath("/fpdb/ClaimMart_Access.mdb")
objconn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & connpath
Dim THMO
THMO = request.querystring("HMO")
set objrs=objconn.execute("SELECT * FROM Tbl_DocAttached_Summary WHERE (HMO = THMO)")
%>
<%
' Loop through each Field, printing out the Field Names
For i = 0 to objrs.fields.count - 1
%>
<% next %>
<%
' Loop through rows, displaying each field
while not objrs.eof
%>
<% For i = 0 to objrs.fields.count - 1
%>
<% Next %>
<%
objrs.MoveNext
wend
objrs.Close
objconn.close
%><% = objrs(i).name %> | <% = objrs(i) %> |
|
|
|
|
|
THMO looks like it is a variable. Try:
THMO = request.querystring("HMO")
set objrs=objconn.execute("SELECT * FROM Tbl_DocAttached_Summary WHERE (HMO = '" & THMO & "')") When you get that to work then I would advise you search for "SQL Injection Attack" then change this to a command parameter.
Hope that helps.
Andy
|
|
|
|
|
That wotked great! thank you! Now I am having trouble getting the select statement to work if the user doesnt select a value on the previous page. The value defaults to a % and I don't know what to change it to so the query selects all the records???
|
|
|
|
|
Try:
set objrs=objconn.execute("SELECT * FROM Tbl_DocAttached_Summary WHERE (HMO LIKE '" & THMO & "')") The "%" sign is a wildcard character that matches everything.
|
|
|
|
|
the shell command should run particular executable but it is not working. is there any another way for executing exe file on client machine through vbscript or javascript.
|
|
|
|
|
This could suffice
[Javascript]
document.write('Please start Word up'); Overwise I don't think user's will be happy to have you running executables on their machines.
Brad
Australian
- Captain See Sharp on "Religion"
any half intelligent person can come to the conclusion that pink unicorns do not exist.
|
|
|
|
|
By design, your web browser is not permitted to access your hard drive with the exception of cookies.
If you want to access a hard drive from a web browser then you can create and use an Active X Control. But these Active X Controls will need permission from client to run.
But don't be too surprised if your clients refuse to use your web site as Active X Controls are highly suspect and dangerous in the wrong hands. Ask yourself a simple question "Why would I allow an unknown executable script to run from an unknown source which could destroy my computer with a single mouse click"?
modified 1-Aug-19 21:02pm.
|
|
|
|
|
Hi,
I have a datagrid that is ment to insert data. But when I run the form only the header appears. I would like some advise from you all and solve this problem I'm using visual studio 2003. My code looks like this:
private void Fill()
{
DataTable table = new DataTable();
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * from dbo.DashBoard", con);
adapter.Fill(table);
}
private void Bind()
{
DataTable table = new DataTable();
dgis.DataSource = table;
dgis.DataBind();
}
private void InsertEmpty()
{
DataTable table = new DataTable();
table.Rows.InsertAt(table.NewRow(), 0);
}
private void bttnew_Click(object sender, System.EventArgs e)
{
// inserting
dgis.EditItemIndex = 0;
// modify text
EditCommandColumn ecc = (EditCommandColumn) dgis.Columns[5];
ecc.UpdateText = "Insert";
EditCommandColumn ecc1 =(EditCommandColumn) dgis.Columns[4];
ecc.UpdateText = "Insert";
// fill table, insert empty row, bind to datagrid
Fill();
InsertEmpty();
Bind();
}
private void dgis_ItemCommand(object source,System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
// stop editing
dgis.EditItemIndex = -1;
switch (e.CommandName)
{
case "Insert":
break;
case "Update":
break;
case "Cancel":
EditCommandColumn ecc =(EditCommandColumn) dgis.Columns[0];
ecc.UpdateText = "Update";
EditCommandColumn ecc1 =(EditCommandColumn) dgis.Columns[0];
ecc.UpdateText = "Update";
break;
case "Edit":
// begin editing
dgis.EditItemIndex = e.Item.ItemIndex;
break;
}
// fill and bind
Fill();
Bind();
}
|
|
|
|
|
nclauder wrote: private void Fill()
{
DataTable table = new DataTable();
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * from dbo.DashBoard", con);
adapter.Fill(table);
}
private void Bind()
{
DataTable table = new DataTable();
dgis.DataSource = table;
dgis.DataBind();
}
private void InsertEmpty()
{
DataTable table = new DataTable();
table.Rows.InsertAt(table.NewRow(), 0);
}
You create a new datatable everytime you do anything which means that when you bind you have nothing in it. You should create it in the originating method and pass it to the three functions as a ByRef variable or create a module level variable.
CleAkO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
Thanks,
The problem still not solved. The row cannot be inserted yet another problem is when I run the form one row from the database converts itself into two rows in the datagrid. what would be the problem? My code now looks like this:
DataTable table = new DataTable();
private DataTable Fill()
{
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * from dbo.DashBoard", con);
adapter.Fill(table);
dgis.DataSource=table;
dgis.DataBind();
return table;
}
private void Bind()
{
dgis.DataSource = Fill();
dgis.DataBind();
}
private void InsertEmpty()
{
table.Rows.InsertAt(table.NewRow(),0);
}
private void bttnew_Click(object sender, System.EventArgs e)
{
// inserting
dgis.EditItemIndex = 0;
// modify text
EditCommandColumn ecc =(EditCommandColumn) dgis.Columns[6];
ecc.UpdateText = "Insert";
// fill table, insert empty row, bind to datagrid
Fill();
InsertEmpty();
Bind();
//dgis.DataBind();
}
private void dgis_ItemCommand(object source,System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
// stop editing
dgis.EditItemIndex = -1;
switch (e.CommandName)
{
case "Insert":
break;
case "Update":
break;
case "Cancel":
EditCommandColumn ecc = (EditCommandColumn) dgis.Columns[6];
ecc.UpdateText = "Insert";
break;
case "Edit":
// begin editing
dgis.EditItemIndex = e.Item.ItemIndex;
break;
}
// fill and bind
Fill();
Bind();
}
|
|
|
|
|
nclauder wrote: private void Bind()
{
dgis.DataSource = Fill();
dgis.DataBind();
}
private void InsertEmpty()
{
table.Rows.InsertAt(table.NewRow(),0);
}
private void bttnew_Click(object sender, System.EventArgs e)
{
// inserting
dgis.EditItemIndex = 0;
// modify text
EditCommandColumn ecc =(EditCommandColumn) dgis.Columns[6];
ecc.UpdateText = "Insert";
// fill table, insert empty row, bind to datagrid
Fill();
InsertEmpty();
Bind();
//dgis.DataBind();
}
You are setting the .DataSource = Fill(); but then in the Fill() you are setting the .DataSource and .DataBind . You are also inserting the row after the initial bind so you are sort of repeating steps unnecessarily.
Try this.
DataTable table = new DataTable();
private DataTable Fill(){
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * from dbo.DashBoard", con);
adapter.Fill(table);
return table;
}
private void Bind(){
dgis.DataSource = Fill();
dgis.DataBind();
}
private void InsertEmpty(){
table.Rows.InsertAt(table.NewRow(),0);
}
private void bttnew_Click(object sender, System.EventArgs e){
dgis.EditItemIndex = 0;
EditCommandColumn ecc =(EditCommandColumn) dgis.Columns[6];
ecc.UpdateText = "Insert";
Fill();
InsertEmpty();
Bind();
} Why are you inserting an empty row when you begin editing? You should be able to just read in that row on the datagrid and add it to the datatable after the editing is finished. Check out http://www.datagridgirl.com[^].
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
Thanks cleako,
This has solved the problem of one row multiplying into two. But I still press a button and it does not return a new column. I've writen the code for insert but still no change?
DataTable table = new DataTable();
private DataTable Fill()
{
SqlDataAdapter adapter = new SqlDataAdapter("select * from dbo.DashBoard", con);
adapter.Fill(table);
return table;
}
private void Bind()
{
dgis.DataSource = table;
dgis.DataBind();
}
private void InsertEmpty()
{
table.Rows.InsertAt(table.NewRow(), 0);
}
private void bttnew_Click(object sender, System.EventArgs e)
{
// inserting
dgis.EditItemIndex = 0;
// modify text
EditCommandColumn ecc = (EditCommandColumn) dgis.Columns[6];
ecc.UpdateText = "Insert";
// fill table, insert empty row, bind to datagrid
Fill();
InsertEmpty();
Bind();
}
private void dgis_ItemCommand(object source,System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
// stop editing
dgis.EditItemIndex = -1;
switch (e.CommandName)
{
case "Insert":
System.Web.UI.WebControls.TextBox st=new System.Web.UI.WebControls.TextBox();
st=(System.Web.UI.WebControls.TextBox)e.Item.Cells[5].FindControl("txtobjach");
System.Web.UI.WebControls.TextBox st1=new System.Web.UI.WebControls.TextBox();
st1=(System.Web.UI.WebControls.TextBox)e.Item.Cells[4].FindControl("txtobj");
System.Web.UI.WebControls.TextBox st2=new System.Web.UI.WebControls.TextBox();
st2=(System.Web.UI.WebControls.TextBox)e.Item.Cells[3].Controls[0];
System.Web.UI.WebControls.TextBox st3=new System.Web.UI.WebControls.TextBox();
st3=(System.Web.UI.WebControls.TextBox)e.Item.Cells[2].Controls[0];
System.Web.UI.WebControls.TextBox st4=new System.Web.UI.WebControls.TextBox();
st4=(System.Web.UI.WebControls.TextBox)e.Item.Cells[1].Controls[0];
System.Web.UI.WebControls.TextBox st5=new System.Web.UI.WebControls.TextBox();
st5=(System.Web.UI.WebControls.TextBox)e.Item.Cells[0].Controls[0];
SqlCommand myCommand=new SqlCommand();
myCommand.Connection=con;
myCommand.CommandText="insert into DashBoard (ObjectiveAchieved,Objective) values ('@ObjectiveAchieved' ,'@objective');";
myCommand.Parameters.Add(new SqlParameter("@ObjectiveAchieved",SqlDbType.Char,45));
myCommand.Parameters["@ObjectiveAchieved"].Value=st.Text;
myCommand.Parameters.Add(new SqlParameter("@Objective",SqlDbType.Char,45));
myCommand.Parameters["@Objective"].Value=st1.Text;
myCommand.Parameters.Add(new SqlParameter("@Workinghrs",SqlDbType.Char,45));
myCommand.Parameters["@Workinghrs"].Value=st2.Text;
myCommand.Parameters.Add(new SqlParameter("@Loggedout",SqlDbType.Char,45));
myCommand.Parameters["@Loggedout"].Value=st3.Text;
myCommand.Parameters.Add(new SqlParameter("@Loggedin",SqlDbType.Char,45));
myCommand.Parameters["@Loggedin"].Value=st4.Text;
myCommand.Parameters.Add(new SqlParameter("@MoodToday",SqlDbType.Char,45));
myCommand.Parameters["@MoodToday"].Value=st5.Text;
con.Open();
myCommand.ExecuteNonQuery();
con.Close();
dgis.EditItemIndex=-1;
BindDataGrid();
break;
case "Update":
break;
case "Cancel":
break;
case "Edit":
// begin editing
EditCommandColumn ecc = (EditCommandColumn) dgis.Columns[6];
ecc.UpdateText = "Insert";
dgis.EditItemIndex = e.Item.ItemIndex;
break;
}
// fill and bind
Fill();
Bind();
}
Thanks.
|
|
|
|
|
installation and usage of apache server ? sample to use apache server
Manjunath S
GESL
Bangalore
|
|
|
|
|
What is it you want?
Brad
Australian
- Captain See Sharp on "Religion"
any half intelligent person can come to the conclusion that pink unicorns do not exist.
|
|
|
|
|
I am working on a basic internal site, I just added a new simple page that fills a simple DataGrid with data from a SQL table, aside from the conversion issue reference below all seemed to go smooth until I tried to deploy it.
when I try to run it on teh server I get teh error:
"File or Assembly name CrystalDecisions.CrystalReports.Engine or one of its dependancies was not found"
I appears there is a new entry in my web.config file as follows. The portion after compilation, default language and debug="true" part is new.
<compilation defaultlanguage="vb" debug="true"><assemblies><add assembly="CrystalDecisions.CrystalReports.Engine, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"><add assembly="CrystalDecisions.ReportSource, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"><add assembly="CrystalDecisions.Shared, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"><add assembly="CrystalDecisions.Web, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304">
If I try to take it out I get an error, does anyone know where this came from and/or the best way to resolve the issue?
I think I did drag a Crystal Reports Viewer on teh form at one point but removed it...
Thanks in advance,
|
|
|
|
|
The correct crystel reports dlls need to installed on your web server. I have gotten this error before. If your web.config file you probably have something like this:
<assemblies>
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=11.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Enterprise.Framework, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Shared, Version=11.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Enterprise.InfoStore, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Web, Version=11.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportSource, Version=11.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</assemblies>
That stuff needs to be removed if you are not using crystel reports.
Hope that helps.
Ben
|
|
|
|
|
Thanks, I tried removing it and got another error... think I messed up the syntax someplace when I removed it correctly all is well.
Thanks
|
|
|
|
|
I have a web form that a user fills out. The form fills in several tables which key off another table that I'll call Table1. When I add a record to Table2, I need a valid key from Table1. What I'm currently doing is adding a record to Table1 and using the key SQL Server returns to me. So far so good. My problem is if the user doesn't complete the form, I'll have a basically empty record in Table1 and bunch of records in Table2.
What I would do in a desktop app would be to use DataTables (C#) in memory and update the DB later but since this is a Web Form, I don't want to kill the server with a bunch of extra junk.
So is what I'm currently doing correct? Should I write a utility/query to clean out the half completed records? Am I correct in assuming that keeping a couple DataTables in memory for each logged in user is bad practice?
Thanks in advance!
|
|
|
|
|
I have a SQL database with a "Real" field called "MinutesRemining", I am trying ot load it into a DataGrid as in the example below:
<br />
Dim dt As New DataTable<br />
Dim MyDataRow As DataRow<br />
<br />
dt.Columns.Add(New DataColumn("MinutesRemaining", GetType(GetSQLInt32)))<br />
<br />
sqlStatement = "Select MinutesRemaining from tblStatusLot "<br />
<br />
Dim cmd As New SqlCommand(sqlStatement, cn)<br />
Dim dr As SqlDataReader = cmd.ExecuteReader<br />
Do While dr.Read()<br />
MyDataRow = dt.NewRow()<br />
MyDataRow(0) = dr.GetSqlInt32(0)<br />
The database field type is "Real", but there is not an option for real in the "dr." options, nor is there one in the DataColumn function options. I get an error "Specified Cast is Not Valid", when I use GetDouble, GetSQLInt32, I am not what conversion I should be usng as there is not an option for Real.
Thanks in advance...
|
|
|
|
|
Hard to know for sure, but I think what you want here is the Decimal type GetSqlDecimal. So the type in your table will also need to be of Type Decimal or float. I am pretty sure if you have a real number in sql calling it an int is not going to work.
Hope that helps.
Ben
|
|
|
|
|
Thanks for the suggestion, I changed the table and tried a few other casts. It turns out to be happiest with no casting at all... Now why did I not think if that first....
|
|
|
|
|