|
|
Thank you.
I think the "-s" option cannot be used with "-i". I tried to add it, but the utility just printed it's syntax text, as if the parameters were incorrect.
Like so:
winhttpcertcfg -i CertificateFile.p12-c LOCAL_MACHINE\My -s CertifiaceFile
-a COMPUTERNAME\USERNAME -p PASSWORD
on the other hand, it was accepted with "-l":
winhttpcertcfg -l -c LOCAL_MACHINE\MY -s CertificateFile
|
|
|
|
|
VB6 has effectively been "dead" for over 15 years. You'll struggle to find documentation or support for it, since most people have moved to .NET by now. With the release of Visual Studio Community[^], so long as you're within the limits, you can upgrade for free.
The only issue is, Windows XP doesn't support anything above .NET 4.0. But support for Windows XP ended over three years ago[^]. Aside from the occasional notable exception[^], your customer's computers have not received a security update for any vulnerability discovered in that time. Since it seems they're connected to the internet, they're ticking time-bombs waiting to destroy the network.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The fact i am using VB6 right now should not matter. The program is using Windows winhttp.dll, a COM object. I could have used C++ and still have the same problem.
|
|
|
|
|
His commentary on VB6 was not directed at the problem at hand but the code you're writing by your language of choice. Since VB6 has been dead for so long, how long is it going to be before the runtime no longer works on Windows and you, or some successor, will be rewriting this thing in a modern language?
|
|
|
|
|
The server company sent me a .PEM certificate to install. Once I did that, the problem was solved.
Thank you.
|
|
|
|
|
How to do an exe on visual studio attach to sqlite. I have tried it and voicke code error: Unable to open the database file
It makes me self that I search on the net may not have concrete answer that helps me. I was advised sqlite to embed the database but how to do it ?? I need your help
|
|
|
|
|
Member 13322378 wrote: Unable to open the database file
Perhaps that file does not exist. This is the first thing to note, if the file does not exist how can you even read it?
Also, you did not mention which language you are using? You are in the Visual Basic forum and only mentioning Visual Studio here. I will assume you want to use the C# library (or VB.NET, they are both same).
c# - SQLIte unable to open database - Stack Overflow
Secondly, it might be that the server or program requires some additional permissions so that the library can properly connect to the database. There is a long conversation and they all boil down to the permissions (read and write, both) of your database + directory where that file is, so that SQLite can easily update the data in the database.
Fixing Sqlite error "unable to open database file"
For simplest of the tasks, you should try using this Firefox addon for SQLite manager, and see if it can access and open the database for you: SQLite Manager :: Add-ons for Firefox... It will help you understand whether there is a problem or not.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Thanks mr.
All my apologies I program under visual studio in csharp. And I installed sqlite server 3.9.1. I would like to know if I need to uninstall and use firefox ??
And how do I go about doing the exe and install it on another computer
|
|
|
|
|
Member 13322378 wrote: I program under visual studio in csharp. So why post in the Visual Basic forum? But, be that as it may, you can take a look at System.Data.SQLite[^]
|
|
|
|
|
Since the repost in the VS-category is newer than this thread, I'm assuming you're still struggeling with the concept. SQLite is not a server-database, it is meant as a lightweight database-solution for local usage of your application. That gives SQLite some advantages and some disadvantages over a server-product.
Richard linked you the System.Data.SQLite page; that wiki explains how to use and deploy SQLite. You'll probably end up xcopying two files along with your executable.
Some other points; if you have been "searching for five months" than you have wasted time that you could have used to read the documentation. Next, "help me" is not a decent subject-line. Everyone who posts here is looking for help - and your question is rather specific to SQLite and C#.
So, post your code, and let us see how you connect to your datafile. Once we have code, we can talk about possible locations where things can go wrong and what it is exactly that you need to verify.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi
Sorry for the topic
"help me"
I used the dataset
Here is my code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SQLite;
namespace ACode
{
public partial class Form1 : Form
{
public static string randomstring(int length)
{
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWYZ0123456789";
Random random = new Random();
return new string(Enumerable.Repeat(chars, length).Select(s => s[random.Next(s.Length)]).ToArray());
}
public Form1()
{
InitializeComponent();
}
private void infoCodeBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.infoCodeBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.dBCodeAleatoireDataSet);
}
private void Form1_Load(object sender, EventArgs e)
{
this.infoCodeTableAdapter.Fill(this.dBCodeAleatoireDataSet.InfoCode);
}
private void btn100_Click(object sender, EventArgs e)
{
labelAffichage.Text = randomstring(4);
codeTextBox.Text = labelAffichage.Text;
prixCodeTextBox.Text = "100";
}
private void btn250_Click(object sender, EventArgs e)
{
labelAffichage.Text = randomstring(5);
codeTextBox.Text = labelAffichage.Text;
prixCodeTextBox.Text = "250";
}
private void btn500_Click(object sender, EventArgs e)
{
labelAffichage.Text = randomstring(6);
codeTextBox.Text = labelAffichage.Text;
prixCodeTextBox.Text = "500";
}
}
}
|
|
|
|
|
Where is the connectionstring? I do not see anything that references your database-file.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi
Please forgive me, this may be a simple answer for some. I have self taught myself VB.net and have developed some software for myself. I often get code samples for hardware that i use, but it is in C#. I have used code converters, but I still seem to get issues. The major issue I have is below. The C# code works perfectly, but the VB code gives me a "Object reference not set to an instance of an object.'" error when I call the connect sub. Please help.
C# Code
using SPORTident;
using System.Windows.Forms;
using SPORTident.Communication;
using System;
namespace SportidentMinimal
{
public partial class MainForm : Form
{
public Reader reader;
public MainForm()
{
InitializeComponent();
reader = new Reader
{
WriteBackupFile = true,
BackupFileName = System.IO.Path.Combine(Environment.CurrentDirectory, $@"backup\{DateTime.Now:yyyy-MM-dd}_stamps.bak")
};
reader.DeviceConfigurationRead += new DeviceConfigurationReadEventHandler(reader_DeviceConfigurationRead);
reader.InputDeviceChanged += new ReaderDeviceChangedEventHandler(reader_InputDeviceChanged);
reader.InputDeviceStateChanged += new ReaderDeviceStateChangedEventHandler(reader_InputDeviceStateChanged);
reader.CardRead += new SPORTident.DataReadCompletedEventHandler(reader_CardRead);
}
private void reader_DeviceConfigurationRead(object sender, StationConfigurationEventArgs e)
{
writeLog("StationConfigRead, OperatingMode: " + e.Device.OperatingMode);
writeLog("StationConfigRead, LegacyProtocolMode: " + e.Device.LegacyProtocolMode);
writeLog("StationConfigRead, AutoSend: " + e.Device.AutoSendMode);
writeLog("StationConfigRead, FirmwareVersion: " + e.Device.FirmwareVersion);
writeLog("StationConfigRead, CodeNumber: " + e.Device.CodeNumber);
writeLog("StationConfigRead, SerialNumber: " + e.Device.SerialNumber);
}
private void reader_InputDeviceStateChanged(object sender, ReaderDeviceStateChangedEventArgs e)
{
writeLog("InputDeviceStateChanged: " + e.PreviousState + " => " + e.CurrentState);
}
private void reader_InputDeviceChanged(object sender, ReaderDeviceChangedEventArgs e)
{
writeLog("InputDeviceChanged: " + e.PreviousDevice + " => " + e.CurrentDevice);
}
private void reader_CardRead(object sender, SportidentDataEventArgs e)
{
SportidentCard card = e.Cards[0];
writeLog("Card read: " + card.Siid);
}
private void button_refresh_Click(object sender, EventArgs e)
{
writeLog("Refresh pressed");
clearSIDevices();
getSIDevices();
}
private void button_sportidentConnect_Click(object sender, EventArgs e)
{
writeLog("Connect pressed");
try
{
connect();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void button_sportidentDisconnect_Click(object sender, EventArgs e)
{
writeLog("Disconnect pressed");
disconnect();
}
private void writeLog(string text)
{
if (listBox_log.InvokeRequired)
{
listBox_log.Invoke(new Action(() => writeLog(text)));
}
else
{
listBox_log.Items.Add(text);
listBox_log.SelectedIndex = listBox_log.Items.Count - 1;
listBox_log.SelectedIndex = -1;
}
}
private void clearSIDevices()
{
writeLog("Clearing list of devices");
comboBox_sportidentDevices.Items.Clear();
}
private void getSIDevices()
{
writeLog("Scanning for available devices");
ReaderDeviceInfo.GetAvailableDeviceList();
foreach (ReaderDeviceInfo device in ReaderDeviceInfo.AvailableDevices)
{
comboBox_sportidentDevices.Items.Add(device);
writeLog("Adding device: " + device.DeviceName);
}
if (comboBox_sportidentDevices.Items.Count > 0)
{
writeLog("Found " + comboBox_sportidentDevices.Items.Count + " devices");
comboBox_sportidentDevices.SelectedIndex = 0;
}
else
{
writeLog("No devices found");
}
}
private void connect()
{
ReaderDeviceInfo readerDeviceInfo = (ReaderDeviceInfo)(comboBox_sportidentDevices.SelectedItem);
reader.InputDevice = readerDeviceInfo;
reader.OutputDevice = new ReaderDeviceInfo(ReaderDeviceType.None);
reader.OpenInputDevice();
reader.OpenOutputDevice();
comboBox_sportidentDevices.Enabled = false;
button_refresh.Enabled = false;
button_sportidentConnect.Enabled = false;
button_sportidentDisconnect.Enabled = true;
}
private void disconnect()
{
comboBox_sportidentDevices.Enabled = true;
button_refresh.Enabled = true;
button_sportidentConnect.Enabled = true;
button_sportidentDisconnect.Enabled = false;
reader.CloseInputDevice();
}
}
}
VB.NET Code
Imports SPORTident
Imports SPORTident.Communication
Public Class Results_Capture_Enduro
Public reader As Reader
Public Sub New()
InitializeComponent()
reader = New Reader() With {
.WriteBackupFile = True,
.BackupFileName = System.IO.Path.Combine(Environment.CurrentDirectory, "backup\{DateTime.Now:yyyy-MM-dd}_stamps.bak")
}
AddHandler reader.DeviceConfigurationRead, New DeviceConfigurationReadEventHandler(AddressOf reader_DeviceConfigurationRead)
AddHandler reader.InputDeviceChanged, New ReaderDeviceChangedEventHandler(AddressOf reader_InputDeviceChanged)
AddHandler reader.InputDeviceStateChanged, New ReaderDeviceStateChangedEventHandler(AddressOf reader_InputDeviceStateChanged)
AddHandler reader.CardRead, New SPORTident.DataReadCompletedEventHandler(AddressOf reader_CardRead)
End Sub
Private Sub reader_DeviceConfigurationRead(sender As Object, e As StationConfigurationEventArgs)
writeLog("StationConfigRead, OperatingMode: " & e.Device.OperatingMode.ToString)
writeLog("StationConfigRead, LegacyProtocolMode: " & e.Device.LegacyProtocolMode.ToString)
writeLog("StationConfigRead, AutoSend: " & e.Device.AutoSendMode.ToString)
writeLog("StationConfigRead, FirmwareVersion: " & e.Device.FirmwareVersion.ToString)
writeLog("StationConfigRead, CodeNumber: " & e.Device.CodeNumber.ToString)
writeLog("StationConfigRead, SerialNumber: " & e.Device.SerialNumber.ToString)
End Sub
Private Sub reader_InputDeviceStateChanged(sender As Object, e As ReaderDeviceStateChangedEventArgs)
writeLog("InputDeviceStateChanged: " & e.PreviousState.ToString & " => " & e.CurrentState.ToString)
End Sub
Private Sub reader_InputDeviceChanged(sender As Object, e As ReaderDeviceChangedEventArgs)
writeLog("InputDeviceChanged: " & e.PreviousDevice.ToString & " => " & e.CurrentDevice.ToString)
End Sub
Private Sub reader_CardRead(sender As Object, e As SportidentDataEventArgs)
MessageBox.Show("got here")
Dim card As SportidentCard = e.Cards(0)
writeLog("Card read: " & card.Siid.ToString)
End Sub
Private Sub btnRefresh_Click(sender As Object, e As EventArgs) Handles btnRefresh.Click
writeLog("Refresh pressed")
clearSIDevices()
getSIDevices()
End Sub
Private Sub btnConnect_Click(sender As Object, e As EventArgs) Handles btnConnect.Click
writeLog("Connect pressed")
connect()
End Sub
Private Sub btnDisconnect_Click(sender As Object, e As EventArgs) Handles btnDisconnect.Click
writeLog("Disconnect pressed")
disconnect()
End Sub
Private Sub writeLog(Text As String)
If listBox_log.InvokeRequired Then
listBox_log.Invoke(New Action(Sub() writeLog(Text)))
Else
listBox_log.Items.Add(Text)
listBox_log.SelectedIndex = listBox_log.Items.Count - 1
listBox_log.SelectedIndex = -1
End If
End Sub
Private Sub clearSIDevices()
writeLog("Clearing list of devices")
cbbSportIdentDevices.Items.Clear()
End Sub
Private Sub getSIDevices()
writeLog("Scanning for available devices")
ReaderDeviceInfo.GetAvailableDeviceList()
For Each device As ReaderDeviceInfo In ReaderDeviceInfo.AvailableDevices
cbbSportIdentDevices.Items.Add(device)
writeLog("Adding device: " & device.DeviceName.ToString)
Next
If cbbSportIdentDevices.Items.Count > 0 Then
writeLog("Found " & cbbSportIdentDevices.Items.Count.ToString & " devices")
cbbSportIdentDevices.SelectedIndex = 0
Else
writeLog("No devices found")
End If
End Sub
Private Sub connect()
Dim readerDeviceInfo As ReaderDeviceInfo = CType((cbbSportIdentDevices.SelectedItem), ReaderDeviceInfo)
reader.InputDevice = readerDeviceInfo
reader.OutputDevice = New ReaderDeviceInfo(ReaderDeviceType.None)
reader.OpenInputDevice()
reader.OpenOutputDevice()
End Sub
Private Sub disconnect()
'reader = New Reader()
cbbSportIdentDevices.Enabled = True
reader.CloseInputDevice()
End Sub
End Class
The exception seems to come when I have called the connect sub. I am assuming it doesn't like the 4 lines where I reference "reader".
Private Sub connect()
Dim readerDeviceInfo As ReaderDeviceInfo = CType((cbbSportIdentDevices.SelectedItem), ReaderDeviceInfo)
reader.InputDevice = readerDeviceInfo
reader.OutputDevice = New ReaderDeviceInfo(ReaderDeviceType.None)
reader.OpenInputDevice()
reader.OpenOutputDevice()
End Sub
Shane
modified 21-Jul-17 7:43am.
|
|
|
|
|
Please edit your question and show us where the exception occurs.
|
|
|
|
|
Do you have an Item selected inside the Combobox (cbbSportIdentDevices.SelectedItem) ?
What do you see by using the Debugger (in case of exeption) ?
|
|
|
|
|
Hi Ralf
Yes I select a Com port. For my current scenario it happens to be COM5. Its weird that it all works perfectly in C#, but in my project, when I have converted to VB, it gives this exception.
|
|
|
|
|
Hi Shane,
I never thought that you assign a Com-Port at this place.
So ... there are some Information missing to go further.
How is ReaderDeviceInfo declared ?
How and where do you have the COM-Port in your code ? Where do you assign an initialize it ?
I think that are parts which belong to the Designer-Scripts from the C#-Project - you should look also there and perhaps complete your code.
If not try to answer my questions ...
|
|
|
|
|
Perhaps little background will help as I can't post an image of the form. I have an RFID reader which connects to the computer via a usb. The sample app from the supplier (the c# Code). Just provides a list of available devices in a combobox after clicking the refresh button. This all works in my VB code as well and after clicking the button it shows a list of (COM1 and COM5 on my laptop) in the combobox. After selecting the correct COM from the dropdown (COM5 in my case). You then click the connect button and it is at this point that my VB code falls over, but the C# code works fine. The form is very simple, I have compared the designer code and nothing different there either. I'm just very confused as to why the VB code gives the null exception but the C# code doesn't. Yet the code is almost identical.
The writelog is just a list box which provides a log of all the steps taken and events which are initiated by the reader.
Hope this helps
Regards
Shane
|
|
|
|
|
Hi Shane,
when I compare both codes (C# vs. VB) I can't see any relevant difference. For me both codes should do the same.
But any difference must be there ...
So : what about the Visual Studio Settings ? Have you added the required DDL's to the references (I hope the name is right - In German it's called 'Verweis') of your Project ?
Greetings
Ralf
|
|
|
|
|
Yes, all dll's have been added. Very confusing to me, why it doesnt work
|
|
|
|
|
If I put the reader = New Reader() in the connect sub, the error goes away, but nothing works like it should. it doesnt pick up the events or anything
Private Sub connect()
reader = New Reader()
Dim readerDeviceInfo As ReaderDeviceInfo = CType((cbbSportIdentDevices.SelectedItem), ReaderDeviceInfo)
reader.InputDevice = readerDeviceInfo
reader.OutputDevice = New ReaderDeviceInfo(ReaderDeviceType.None)
reader.OpenInputDevice()
reader.OpenOutputDevice()
End Sub
|
|
|
|
|
Let's get back to the ComboBox and it's ReaderDeviceInfo ...
I can't see a code-line where the ComboBox is assigned/filled AND with what it is filled.
I suggest that you should look there ...
|
|
|
|
|
Shane James wrote: If I put the reader = New Reader() in the connect sub, the error goes away, but nothing works like it should. it doesnt pick up the events or anything
This is normal: you create a new instance of the Reader class but this one is not configured like the first one was in the constructor of Results_Capture_Enduro . But I don't think the problem is here, you should remove this line.
You did not tell us which variable triggers the exception. To find it you can remove the try...catch block around the call to connect() to let the debugger stop at the line the exception occurs.
There is one line where the VB code is not equivalent to its C# counterpart:
Dim readerDeviceInfo As ReaderDeviceInfo = CType((cbbSportIdentDevices.SelectedItem), ReaderDeviceInfo)
The strictly equivalent version would be:
Dim readerDeviceInfo As ReaderDeviceInfo = DirectCast((cbbSportIdentDevices.SelectedItem), ReaderDeviceInfo)
See this article:
DirectCast vs. CType[^]
for explanations. In general using CType for a simple type cast is dangerous because it will try to do something even if the cast is not possible, so that the error may propagate to other parts of the code where it is difficult to understand.
NB. Also be careful when translating from C# to VB.NET as the latter is not really case sensitive which may cause compilation errors:
vb.net - Is VB really case insensitive? - Stack Overflow[^]
|
|
|
|
|
Shane James wrote: it shows a list of (COM1 and COM5 on my laptop) in the combobox. I am going to guess that it does not contain a list of strings that represent comports, but objects.
Show us how the VB version that initializes the combobox looks like.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|