|
hi,
I am trying to write records in a dbase table to a sql tabe. for that i have created the oledb connection and i have filled the datase . now i am trying to fill the sql table. eventhough my coding doesnt show errors sql table doesnt get updated.
plz help me with this . below is my coding
public class TransferClass
{
OleDbConnection oledbConnection = new OleDbConnection();
OleDbCommand oledbCommnd = new OleDbCommand();
OleDbDataAdapter oledbDataadapter = new OleDbDataAdapter();
SqlConnection sqlConnection = new SqlConnection();
SqlCommand sqlInsertCommand = new SqlCommand();
SqlCommand sqlSelectCommamnd = new SqlCommand();
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
public DataSet dsPlu = new DataSet();
string oledbselctString;
string sqlUpdateString;
string sqlSelectString;
//creating oledb connection
void oledbConnectionMethod()
{
oledbConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Z:/cpk;Extended Properties=dBase III";
}
void oledbSelectMethod(string comTxt)
{
oledbCommnd.CommandText = comTxt;
oledbCommnd.Connection = oledbConnection;
}
void oledbDataAdapterMethod()
{
oledbDataadapter.SelectCommand = oledbCommnd;
}
void PluFill()
{
oledbConnectionMethod();
oledbselctString = "SELECT PLU_NUM,[DESC],COST_PRICE,QTY,Q_OPEN,O_CP FROM Plu";
oledbSelectMethod(oledbselctString);
oledbDataAdapterMethod();
oledbDataadapter.Fill(dsPlu);
}
void sqlConnectionMethod()
{
sqlConnection.ConnectionString = "Data Source=RUWANDI;Initial Catalog=MIS;User Id=sa";
}
void sqlupdateMethod(string UpComTxt)
{
sqlInsertCommand.CommandText = UpComTxt;
sqlInsertCommand.Connection = sqlConnection;
}
void sqlselectMethod(string SelComTxt)
{
sqlSelectCommamnd.CommandText = SelComTxt;
sqlSelectCommamnd.Connection = sqlConnection;
}
void sqlDataAdapterMethod()
{
sqlDataAdapter.InsertCommand = sqlInsertCommand;
sqlDataAdapter.SelectCommand = sqlSelectCommamnd;
}
void PluUpdate()
{
sqlConnectionMethod();
sqlDataAdapterMethod();
sqlSelectString = "SELECT * FROM Plu";
sqlselectMethod(sqlSelectString);
sqlDataAdapter.SelectCommand = sqlSelectCommamnd;
sqlDataAdapter.Fill(dsPlu);
PluFill();
sqlUpdateString = "INERT INTO Plu(PLU_NUM,[DESC],COST_PRICE,QTY,Q_OPEN,O_CP) VALUES (PLU_NUM,[DESC],COST_PRICE,QTY,Q_OPEN,O_CP IN dsPlu)";
sqlupdateMethod(sqlUpdateString);
sqlDataAdapter.InsertCommand = sqlInsertCommand;
SqlCommandBuilder comBuilder = new SqlCommandBuilder(sqlDataAdapter);
sqlDataAdapter.Update(dsPlu);
}
public void Excecute()
{
PluUpdate();
}
}
Thx
rkherath
rkherath
|
|
|
|
|
I am exporting data grid to excel. (Tech .Net, C#, Sql Server) It is working fine on my network ( work on both IE 6.0 and 7.0 version ) But on client side the window is closing itself automatically.
I hit the Client Site url from my pc it is working fine.
I am not able to spot the problem if there is any security reason there. The exported excel open as pop up window. Client tried after removing popup blocker also, still same problem exits. To my surprise if you press CTRL key and continue then the excel sheet is open there without problem.
Please suggest me for possible problem.
Thanks in advance.
------------------------CODE USED----------------------------
DataTable dt= con.GenrateReport(Convert.ToInt32( repconfigid),FormId,FormTypeId,fromDate,enddate,status);
dgReport.DataSource=dt;
dgReport.DataBind();
worksheetname=FormName + " Report";
//
// going to export into excel our grid
//
Context.Response.Buffer = true;
Context.Response.ClearContent();
Context.Response.ClearHeaders();
Context.Response.ContentType = "application/vnd.ms-excel";
Context.Response.ContentEncoding = System.Text.Encoding.Default;
Context.Response.AppendHeader("Content-Disposition", "attachment;filename=" + worksheetname + ".xls");
EnableViewState = true;
StringWriter tw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
tblGrid.RenderControl(hw);
//dgReport.RenderControl(hw);
Context.Response.Write(tw.ToString());
Context.Response.Flush();
Context.Response.Close();
Context.Response.End();
Raj Kumar
|
|
|
|
|
Hi,
I want some instructions in how to convert existing C# Windows Application to C# Web Application..
Please post your replies as soon as possible..
|
|
|
|
|
write a n-tier application. One of the layers should be GUI only.
Then you can "attach" a windows forms or web based GUI to your application.
V.
I found a living worth working for, but haven't found work worth living for.
|
|
|
|
|
If the application has been properly architected it should just be a matter of rewriting the presentation (UI) layer - perhaps with the odd addition elsewhere to support a stateless model of working. If it hasn't been well architected then you are looking at rewriting the whole application.
|
|
|
|
|
Spamming different 10 forums with the same question is very rude and totally unnecessary.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi All,
I am required to create a program which when triggered, automatically dials specified telephone numbers and plays prerecorded sound. In usual IVR user dials, but here system is supposed to dial the users. I am new to this domain. So need little direction on doing this.
Thanks
|
|
|
|
|
|
how to apply checkbox inside datagrid for pocket pc 2003 (language c#)
help me
meraj
B
|
|
|
|
|
Are you using Webforms or Winforms?
When using ASP.NET Webforms I would recommend using a GridView.
when using Winforms I would recommend using a DataGridView.
public object BufferOverFlow<br />
{<br />
__get { return BufferOverFlow; }<br />
__set { BufferOverFlow = value; }<br />
}
|
|
|
|
|
hello
i want to use System DataGrid in pocket pc 2003 with checkbox feature
please help me
small
|
|
|
|
|
HI i had created one setup solution for an c# application. I tried to install the application in another machin's shared folder.It was a sucess.
But it shows an error message when i tried to run the application
The error message was like this....
The operation is not aloowed due to security policy.The operartion required SecurityException.use the Microsoft .net security policy administration tool
please help
My small attempt...
|
|
|
|
|
could you copypaste or screenshot the exact errormessage? makes it a lot easier to find a solution.
I had a similar problem recently when deploying a ASP.NET application under a Sharepoint webserver. Where I had to edit the wss_minimaltrust.config and machine.config.
public object BufferOverFlow<br />
{<br />
__get { return BufferOverFlow; }<br />
__set { BufferOverFlow = value; }<br />
}
|
|
|
|
|
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitdebugging="true">
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
My small attempt...
|
|
|
|
|
I don't really see any errormessages. Where did you copypaste this from?
public object BufferOverFlow<br />
{<br />
__get { return BufferOverFlow; }<br />
__set { BufferOverFlow = value; }<br />
}
|
|
|
|
|
i cant copy paste the picture.........
i didnt works
My small attempt...
|
|
|
|
|
hi all
i want to make a remoting applications in which i have some events which i want to handle on my clients,but i dont know how to register events on my clients,
any example code, ane help will be highly appreciated,
thanks in advance
hello
|
|
|
|
|
I know this is not the answer you are looking for but when dealing with remoting then keep it simple and stick to method calls only over the network ... using Events with remoting is very sticky bizz. There's a whole lot of issues that make event handling with remoting a bitch. A way to simunate it is to have an event at both ends ... so a remote call triggers an event ..
But if you really really really wants to use events (the whole u have to seriealze everything sent over the network nightmare .. )
Search the remoting section here on Codeproject .... there's no perfect solution.
|
|
|
|
|
Is it possible to just simply output a byte reprisentation of an int as a string.. for example out put 10 as "1010".
Or do I have to loop through the number and do all the division manualy?
Thanks.
|
|
|
|
|
|
good morning every1..im in a middle of something..
im taking a C# course and my assignment is to move a button using Thread....
this is the link for the form:
[url=http://www.0zz0.com/realpic.php?s=3&pic=2007/03/18/23/89686027.jpg][img]http://www3.0zz0.com/thumps/2007/03/18/23/89686027.jpg[/img][/url]
i wanna move it by pressing de Start button and pause it then resume it
and this is the code
/////////////////
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
private delegate void Moveobject(string m);
private Thread g = null;
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
label1.Text = DateTime.Now.ToString();
}
private void button6_Click(object sender, EventArgs e)
{
//
button6.Enabled = false;
g = new Thread(new ThreadStart(move));
g.Start();
}
//
private void move()
{
Moveobject mv = new Moveobject(moveitinpanel);
for (int x = 0; x < 100; x++)
{
for (int y = 0; y <= x; y++)
{
if (x >= y)
y++;
this.Invoke(mv, x.ToString());
//this.Invoke(mv, y.ToString());
}
}
}
//im stuck here
private void moveitinpanel(int x, int y)
{
button7.Location = x;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
//
private void button4_Click(object sender, EventArgs e)
{
if (g != null)
{
if (g.ThreadState == ThreadState.Running)
{
try
{
g.Suspend();
button4.Text = "resume";
}
catch (Exception ex)
{
}
}
if (g.ThreadState == ThreadState.Suspended)
{
try
{
g.Resume();
button4.Text = "pause";
}
catch (Exception ex)
{
}
}
}
}
//
private void button5_Click(object sender, EventArgs e)
{
if (g != null)
{
try
{
button6.Enabled = true;
g.Abort();
}
catch (Exception ex)
{
}
}
}
}
}
plz if ne1 knows...let me no
thank u very much
|
|
|
|
|
aymolly wrote: //im stuck here
private void moveitinpanel(int x, int y)
{
button7.Location = x;
}
If you look at the documentation you'll see that Location is a Point structure so what you want is:
button7.Location = new Point(x, y);
|
|
|
|
|
here your delegate function have only one parameter "string m"
private delegate void Moveobject(string m);
But in the function your are trying to use int x and int y;
Please try to change the delegate as
private delegate void Moveobject(int x, int y);
My small attempt...
|
|
|
|
|
You might want to try replying to the original poster.
|
|
|
|
|
Hi,
I'm using a NumericUpDown control (C# .NET 2.0 Windows Form) so user can enter a quantity value.
After the WinForm's data is saved, I want to reset the NumbericUpDown control to it's default value (1).
Using this code works if any value is in the box:
numericUpDown_Quantity.Value = 1;
but if the user removes all text (values) from the NumericUpDown box, it does not paste the 1 back into the box.
The value has updated in memory (if you click UP, the next value is 2), but the box still shows empty. I've tried:
numericUpDown_Quantity.Update();
numericUpDown_Quantity.Refresh();
numericUpDown_Quantity.ResetText();
Any help would be appreciated.
Thanks,
Ron
-- modified at 18:02 Sunday 18th March, 2007
|
|
|
|