|
I’m trying to download and upload data to a Microsoft access database. But cant even get my head round starting to figure it out.
Any help or nudge in the right direction would be excellent and would make me very grateful.
RandyD
|
|
|
|
|
I guess you can start with How to link to an Access Database in a C# Application[^] here on CP. The code is, obviously, in C#, but is easily convertable to VB.NET either by-hand, or using various translators on the 'Net.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How to do I navigate to another list in a DataList. I only want one record perpage. I have been searching
for an answer and I have come up with nothing. If anyone has any ideas please share them with me. I would
so apprecitate it.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Microsoft.Data.Odbc;
using System.Text;
namespace MSPOS
{
///
/// Summary description for Objects.
///
public class Objects : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataList myDataGrid;
protected System.Web.UI.HtmlControls.HtmlForm Form1;
private DataSet ddlDataSet1 = new DataSet();
private DataSet ddlDataSet = new DataSet();
protected Int32 _currentPageNumber = 1;
protected int PageSize = 1;
public void Page_Load ( Object sender, EventArgs e )
{
if ( !Page.IsPostBack )
{
BindData();
}
}
public void BindData()
{
OdbcConnection myConnection = new
OdbcConnection("DSN=POS;UID=system;PWD=system");
myConnection.Open();
// get records from the table
string commandString = @"SELECT CM_REF, CM_DESCRIPTION,
CM_OBJECTNAME, CM_TIMEOUT, CM_TYPE, CM_CONTENT, CM_PREPARED, CM_CONNECTION FROM
TBCOMMANDS";
// Set the datagrid's datasource to the datareader and databind
// Create a OdbcCommand object and assign the connection connect to
the database
// Create a OdbcCommand object and assign the connection connect to
the database
OdbcCommand command = myConnection.CreateCommand( );
command.CommandText = commandString;
command.Connection = myConnection;
// Create the Reader and bind it to the datagrid
OdbcDataReader reader =
command.ExecuteReader(CommandBehavior.CloseConnection);
ddlDataSet.DataSource=reader;
ddlDataSet.DataBind();
reader.Close();
reader=null;
myConnection.Dispose();
}
private void InitializeComponent()
{
this.myDataGrid.SelectedIndexChanged += new
System.EventHandler(this.myDataGrid_SelectedIndexChanged);
}
private void MyDataGrid_SelectedIndexChanged(object sender,
System.EventArgs e)
{
}
private void myDataGrid_SelectedIndexChanged(object sender,
System.EventArgs e)
{
}
}
}
Thank You for Your Time,
Matt
|
|
|
|
|
You might want to post your question the ASP.NET Forum. You'll get a better result there.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Each time I try to create an ASP.NET Web Application I get the "Web Access Failed" dialog box...IIS is installed and running correctly, however I keep getting the following error message:
The default Web access mode for this project is set to file share, but the project folder at 'http://localhost/WebApplication1' cannot be opened with the path 'c:\Inetpub\wwwroot\WebApplication1'.
Can anybody explain why i keep getting this? IIS is running correctly and so are the rest of my Visual Studio .NET applications...I only get this when I try to create Web Applications...
Thanks
|
|
|
|
|
Run the exe aspnet_regiis with -i switch.
aspnet_regiis will available in the path
C:\Winnt\Microsoft.NET\Framework\[version]\
if you installed your os in the C drive.
|
|
|
|
|
On my datagrid I want to display only one record at a time instead of
four at a time.How do I navigate the grid to make the changes?I only want
one per page.
Thank You for Your Help.
Matt
|
|
|
|
|
You can use paging just set the page size to 1. Then add a pageIndexChanged event to the datagrid to handle the backwards/forward navigation.
|
|
|
|
|
There is one big problem it is a datalist.
|
|
|
|
|
I tried egghead.
Not much help.
I am trying to bind the records from the table to a datalist control in C#
private DataSet BindTBCOMMANDTYPE()
{
OdbcConnection myConnection = new OdbcConnection("DSN=POS;UID=system;PWD=system");
// Populate the ddlDataSet1
myConnection.Open();
const string strSQLDDL = @"SELECT DT_REF, DT_DESCRIPTION FROM TBCOMMANDTYPE ORDER BY DT_REF";
OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL, myConnection);
ddlDataSet1.Clear();
myDataAdapter.Fill(ddlDataSet1, "ddlDATATYPE");
DataSet1.DataSource = ddlDataSet1;
DataSet1.DataBind();
myDataAdapter.Dispose();
myDataAdapter = null;
myConnection.Close();
return ddlDataSet1;
}
Just need the correct syntax.
http://www.eggheadcafe.com/forums/ForumPost.asp?ID=14586&INTID=6
Let's share our knowledge together!!!
mcupryk@sun.net.bb
Matt Cupryk
514-685-0449
|
|
|
|
|
You might want to try posting this in the C# Forum.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am experimenting with MSAgent. (Text to speech)
What I am trying to accomplish is to let the program run until the Esc key is pressed.
The code below works fine in the Visual Basic 6.0 IDE.
However, if you minimize the IDE or compile, the program still runs but pressing the Esc key does nothing.
It's like the program has lost focus.
It works fine in the IDE with no interuption.
Can someone help with this?
Here is the code:
Option Explicit
Public MyAgent As Object
_________________________________
Private Sub Form_KeyPress(keyascii As Integer)
'KeyPreview on the Forms properties window is set to True.
'Press the Esc key to exit.
If keyascii = 27 Then
Unload Me
End
End If
End Sub
__________________________________
Public Sub Delay(Seconds As Long)
Dim n As Double
n = Timer + Seconds
Do While Timer < n
DoEvents
Loop
End Sub
__________________________________
Private Sub Form_Load()
Dim Ap As String
'Set Application Path
Ap = App.Path
If Right(Ap, 1) <> "\" Then Ap = Ap + "\"
'Load the character
Agent1.Characters.Load "merlin", Ap + "merlin.acs"
Set MyAgent = Agent1.Characters("merlin")
'something wrong here
Dim keyascii As Integer
Do Until keyascii = 27
If keyascii = 27 Then End
MyAgent.Show
MyAgent.MoveTo 250, 325
Delay 2
MyAgent.MoveTo 400, 325
Delay 2
Loop
End Sub
|
|
|
|
|
If you applications Form loses the focus AT ALL, pressing ESC won't do anything because the keypress went to some other app. It's not so much a problem of minimizing the IDE as it's a question of which window got the focus after you minimized the IDE.
Make sure you click in the Window of your application before you hit ESC. Otherwise, your application will never see the ESC key being pressed.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for looking Dave.
My problem is that I have no form to click on because of its transparency.
I need to make sure the form doesn't lose focus, but not sure how.
Any ideas?
|
|
|
|
|
It sounds like what you need to do is hook the keyboard instead of depending on KeyDown. If your form is transparent, it suggests that your still using other applications and giving your app things to say from other app. You're application can keep the focus, but in a multitasking operating system, that makes your app quite a p-i-t-a to use.
Check into Application.AddMessageFilter for the .NET way of hooking the keyboard. You can then see all the keyboard messages generated by the keyboard driver, look for your ESC key SYSTEM WIDE, not just the app with the focus.
I'm out of time for today, so I can't get into specifics right now, but I'll be able to do so next week.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for the info Dave.
Is there a snippet available for download some place in regards to
Application.AddMessageFilter?
|
|
|
|
|
|
Thanks Dave,
I have found another way also, however, I need a timer event for it to work:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Form_Load()
Dim k As Long
For k = 0 To 255
GetAsyncKeyState k
Next
End Sub
Private Sub Timer1_Timer()
Dim k As Long
For k = 0 To 255
If GetAsyncKeyState(27) Then End
Exit For
Next
End Sub
|
|
|
|
|
Works, but you don't need the loops in the code at all. You just need to call GetAsyncKeyState with a parameter of 27 and then check it again with the same parameter to read that key and that key only.
Now, GetAsyncKeyState will miss keys because if another app calls GetAsyncKeyState , it will receive the keypressed signal, not your app. The status of the keyboard is not kept application specific, but rather system-wide. ANY call to GetAsyncKeyState will reset the key-pressed flag, not just calls from your app. If you call GetAsyncKeyState , then another app calls it, that app will get the message that ESC was pressed and reset the flag. Now, on the timer tick, your app calls GetAsyncKeyState again, and gues what, since the flag was reset, you'll never know that the key was pressed...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am having problem in Previewing my reports. Same Code is running fine if I dont use my main form as mdi. I will appreciat if someone can help me I search all over the net but couldnt find anything like this. I have my main form as mdi , from menu I am running a form then In form I have a button for preview the report , the preview window is coming up the and error is popping up "An unhandled exception has occurred .... Object reference not set to an instance of an object.
In details: System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Forms.PrintPreviewControl.CalculatePageInfo()
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
My code is very simple
Dim dlg As New PrintPreviewDialog
dlg.Document = mDoc
dlg.WindowState = FormWindowState.Maximized
dlg.ShowDialog()
If I use a non mdi form as main form in my application everything becomes fine without any modification.
|
|
|
|
|
|
I need some help getting started. I need to connect a switch to a com port and in my code trigger an event when the switch state changes. Not to difficult but what pins do I use on the port and how do I insure I will not be hurting the pc. Thanks for your input.
Mike
|
|
|
|
|
The parallel port would be a much better choice for this. You can start by checking out the enormous list of resources at Lakeview Research[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a section of code (shown below) which reads an XML file into a Dataset. The XML file looks like this:
- <NewDataSet>
- <Employees>
<SUPR>Jane Moneypenny</SUPR>
<DEPT>Accounting</DEPT>
<EMP>James Bond</EMP>
<TITL>Accountant</TITL>
<DEADL>11/15/04</DEADL>
<HOURS>24.00</HOURS>
</Employees>
</NewDataSet>
The following code produces a crystal report which I export to a pdf file. Only one row of data is per page. Basically it is a letter that goes to the supervisor per page. My client has asked if I can split the document up where it breaks into individual pdf documents per row or maybe even per supervisor. If it breaks per supervisor, the pdf file may contain multiple employees with a page per employee.
I'm new to VB.NET and not sure how to accomplish this. I've spent two days trying to come up with a for next loop that might work without luck. I'm an old COBOL programmer still trying to get familiar with object oriented programming.
Does anyone have suggestions and/or some sample code to help figure out this task.
I appreciate any help!!
Private Sub step3()
Dim ds As New DataSet
Dim fs As New System.IO.FileStream("c:\test.xml", System.IO.FileMode.Open)
ds.ReadXml(fs)
ds.Tables(0).TableName = "Employees"
Dim xmlReport As New rptRenewalReminder 'Crystal Report
xmlReport.SetDataSource(ds)
Dim frmCrystal As New frmCrystalViewer
frmCrystal.CrystalViewer.ReportSource = xmlReport
frmCrystal.ShowDialog()
Dim myDiskFileDestinationOptions As New DiskFileDestinationOptions
Dim strAdobeRenewalLetter As String
strAdobeRenewalLetter = "test.pdf"
myDiskFileDestinationOptions.DiskFileName = strAdobeRenewalLetter
With xmlReport.ExportOptions
.DestinationOptions = myDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With
xmlReport.Export()
MsgBox(strAdobeRenewalLetter & " has been saved")
End Sub
<b><i><font color="blue">Lost in the vast sea of .NET</font></i></b>
|
|
|
|
|
how can i link a sub report in the main report and pass data to both reports through dataset.Thanx in advance
|
|
|
|