|
I have a sqlite database protected by password and I can't use it in query. How should I modify the code to read data from a protected database?
private static string conn = @"Data Source=aplicatie.db;Pooling=true;FailIfMissing=false;Version=3;Password=example";
An example with query:
string selectutilizator = "SELECT username,prenume,licenta FROM accounts";
SQLiteCommand selcom = new SQLiteCommand(selectutilizator, Conexiune.getConnection());
selcom.CommandType = CommandType.Text;
using (SQLiteDataReader read = selcom.ExecuteReader())
{
if (read.Read())
{
SimulatorManager.Nume = (string)read["username"];
SimulatorManager.Prenume = (string)read["prenume"];
SimulatorManager.Utilizator = SimulatorManager.Nume + " " + SimulatorManager.Prenume;
}
}
Error is:
file is encrypted or is not a database
|
|
|
|
|
Are you sure that the password is correct?
|
|
|
|
|
My next stupid question is: How should I suppose to set a password for sqlite database? ) Cause obviously I don't know how..I thought that I just have to set there a password..
|
|
|
|
|
Speaking for myself, I would start by reading the documentation.
|
|
|
|
|
DPaul1994 wrote: How should I suppose to set a password for sqlite database?
private static string conn = @"Data Source=aplicatie.db;Pooling=true;FailIfMissing=false;Version=3;Password=example"; What happens if you connect using this to a non-existing file?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
As Richard says, the wrong password is the most obvious problem.
Other possibilities are:
1) It's not an SqLite database at all - ".db" is a common enough extension that it could be a different application
2) It's SqLite, but from a different version - check that the DLLs you are using to access it are the latest version, and that you didn't create it in a later application.
If in doubt, it's worth setting up a connection in Visual studio via the Server Explorer pane - if "Connect to Database" doesn't list SqLite then see here: http://stackoverflow.com/questions/19665370/missing-sqlite-data-provider-in-vs-2013[^]
Once you have a working connection in VS, you can get a "good" connection string in the Properties Pane.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I have a new pc and installed new software. Visual Studio 2013 and SQL Server 2014. My old pc had VS 2010 and SS 2012.
Now I have the problem that I created code for working with DTS packages. Worked perfect on the old pc. But the dll is in the GAC of Windows. My new pc has a newer version and won't work. The problem is, that the server where it has to be hosted, also works with the old verion (SS 2012)
I tried to copy the old dll from the GAC and reference it in my new environment, but without luck.
I cannot imagine that I have to install the old software as well on my new pc. I mean, what do you do when your customer has older or newer version in GAC. You must be somehow able to program for that situation.
Anyone any ideas?
|
|
|
|
|
Well, I would suggest you to have a virtual machine on your new PC(VMWare free version). Install all that old software and save the VM on an external drive. This will make it ready to use as and when required.
Your customer will keep coming back to you to get this stuff fixed. This way, you just have to boot your virtual machine and get the job done.
|
|
|
|
|
Hi guys,
I was wondering if there is any impact of the Memory (private working set) towards the performance of the windows services.
I developed a Windows Service program in C#.
Basically what it does is, reading an unstructured text file and then converting it to a structured text file.
File size ranging 1GB to 2GB per file, in multi-threaded.
As what I noted, the higher the Memory (private working set) from the Task manager; it goes, the poorer the program to read and write file.
I already troubleshooting and recode the program in any ways. Still no luck
Any comments to the above, very much appreciated.
Thanks
|
|
|
|
|
Please do not post the same thing in multiple places: it duplicates work and annoys people.
You already have a solution in QA: What to ask: Memory (private working set)[^] so just continue with that one.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Possibly. It depends on how much RAM is in the machine. What's probably happening is that you're getting a lot of swaps back and forth to the page file. Look in Task Manager at the Page Fault and Page Fault Delta columns. You'll probably have to turn these on in the View menu to see them.
Oh, and don't look in Task Manager to see how much memory your .NET app is using. It's lying to you.
|
|
|
|
|
Hello guy as the subject this error shows up and don't know what is the error
Error:System.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at _Default.SOrder_Click(Object sender, EventArgs e) in c:\Users\BC 2\Documents\Visual Studio 2013\WebSites\One Touch Service\Default.aspx.cs:line 39 ClientConnectionId:714e7bcb-5bba-41ab-a493-8f7bf33259b9
|
|
|
|
|
And what is your code? Remember that, just because you can see it we can't.
|
|
|
|
|
abdokouta wrote: String or binary data would be truncated.
What's so hard to understand? You're trying to cram too much data into a field that has some hard limit on the size of the data it can hold.
If we can't see your code and table definition we can't really help any more than this.
|
|
|
|
|
this is my code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
RecievedTime.Text = DateTime.Now.ToString();
if (IsPostBack)
{
}
}
protected void SOrder_Click(object sender, EventArgs e)
{
try
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Data"].ConnectionString);
conn.Open();
string insertQuery = "insert into OrderData (RoomNumber, OrderCode, Details, ReceviedBy, AssignedTo ,RecievedTime) values (@RNumber, @OCode, @Det, @RBy, @Assto, @RTime)";
SqlCommand com = new SqlCommand(insertQuery, conn);
com.Parameters.AddWithValue("@RNumber", RoomN.Text);
com.Parameters.AddWithValue("@OCode", OrderCode.SelectedItem.Text);
com.Parameters.AddWithValue("@Det", Details.Text);
com.Parameters.AddWithValue("@RBy", Receby.SelectedItem.Text);
com.Parameters.AddWithValue("@Assto", Assto.SelectedItem.Text);
com.Parameters.AddWithValue("@RTime", RecievedTime.Text);
com.ExecuteNonQuery();
Response.Redirect("Login.aspx");
Response.Write("Registration SUCESSFULL");
conn.Close();
}
catch (Exception ex)
{
Response.Write("Error:" + ex.ToString());
}
}
}
and i have great a database called Data and there is table in called OrderData and the connection is Orders
|
|
|
|
|
Check if any of the values you are passing is more than the length of the columns in database.
Siddartha K,
.NET Developer,
Wipro Technologies,
India.
|
|
|
|
|
OK. So are any of the data you're sending to the database larger than the fields in the database?
Your code doesn't say what it's sending, how big, nor do you supply anything on the structure of the table you're updating.
|
|
|
|
|
Hey everyone, I am fairly new to learning c# and I wish to know how to make a C# Script to say when the player hits this collider then the next level starts.
Can you please let me know what I have done wrong in below?
Thanks for you help!
Code I have currently:
using UnityEngine;
using System.Collections;
public class newLevelstarter : MonoBehaviour {
float OnTriggerEnter (){
Application.LoadLevel("Scene2"){
}
}
}
|
|
|
|
|
where is the code for Application.LoadLevel()?
and what is the problem or error?
|
|
|
|
|
I'm not exactly sure what that means. I was hoping someone had the same problem and was able to show me what they wrote to fix it. If not then I need to know how to fix it.
|
|
|
|
|
How to fix what? You have not shown any useful code, or explained what problem you are facing. If you are looking for sample code then you need to look in the Articles section, or try a Google search.
|
|
|
|
|
You haven't posted any code so you have nothing to fix. What you're actually doing is asking someone to write your code for you, that is something completely different.
|
|
|
|
|
I was just trying to find out what I did wrong and for someone to correct it. I'm just trying to make a simple level restarter that when a player hits a collider the level restarts?
|
|
|
|
|
You haven't done anything wrong; the problem is that you haven't done anything. If you have some code that does not work then you need to show it so someone can help you with it. What you have in your original question is not even started.
|
|
|
|
|
this is the code for restarting current level as i found on the net. so put this in any trigger, event , method or anything that want to restart the level. it may work
Application.LoadLevel(Application.loadedLevel);
and also dont put '{}' for method calls just ';'
|
|
|
|