|
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....
|
|
|
|
|
Great, I am glad that it worked out. Isn't that funny how it works out that way sometimes?
Ben
|
|
|
|
|
The equivalent .NET data type for a Real is Single . You can use the GetFloat method to read it from the data reader.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi,
I'm trying to Insert a new Row on a dagrid. When I did a google search, I got an example on this address: http://www.codeproject.com/ASPNET_DataGrid.asp.
I've done mycode as follows:
private void Fill()
{
DataSet ds=new DataSet();
SqlDataAdapter adapter =new SqlDataAdapter("select * from DashBoard", con);
adapter.Fill(ds);
}
private void Bind()
{
DataSet ds=new DataSet();
dgis.DataSource = ds;
dgis.DataBind();
}
private void InsertEmpty()
{
DataSet table=new DataSet();
Table.Rows.InsertAt(Table.NewRow(), 0);
}
private void bttnew_Click(object sender, System.EventArgs e)
{
dgis.EditItemIndex = 0;
EditCommandColumn ecc = (EditCommandColumn) dgis.Columns[0];
ecc.UpdateText = "Insert";
Fill();
InsertEmpty();
Bind();
}
private void dgis_ItemCommand(object source,System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
dgis.EditItemIndex = -1;
switch (e.CommandName)
{
case "Insert":
break;
case "Update":
break;
case "Cancel":
EditCommandColumn ecc =(EditCommandColumn) dgis.Columns[0];
ecc.UpdateText = "Update";
break;
case "Edit":
dgis.EditItemIndex = e.Item.ItemIndex;
break;
}
Fill();
Bind();
}
On compiling I get this error
-'System.Web.UI.WebControls.Table' does not contain a definition for 'NewRow'
-'System.Web.UI.WebControls.TableRowCollection' does not contain a definition for 'InsertAt'
-'An object reference is required for the nonstatic field, method, or property 'System.Web.UI.WebControls.Table.Rows'
Where could I be going wrong?
|
|
|
|
|
Hi,
I want a customized User Profile Search. I cannot use GetUserProfile method as it returns only one user profile. What is the way to get a list of users matching the input user name.Please help me with the sharepoint 2007 code for the same.
Thanks in advance...........
Usha
|
|
|
|
|
hi,
i want to do keyword search in word .doc files, e.g in resumes, i want to implement a script in asp 3.0, please guide me by giving some help full links to get started, or give some code snipts... any help will be highly appreciated.
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
Hi all,
actually i am very depressed of VS.NET 2.0 i have a real problem and am sure i'll found the solution here. firstly i can't understand how .net 2.0 doesn't automatically create dll file for the project, while i was using .net 1.1 there was bin\debug which contains dll file for the web project so i can upload it on the server each time i change something in the code. now after converting to .net 2.0 i don't know what to do? also i found a tool which is "web deployment" i installed it and tried to get the dll it works once and didn't work again but when it worked the build number was 0.0.0.0 and it never changes when i make changes and build again. please i really need help if anyone can. Thank you all
|
|
|
|
|