|
|
Olumide Adebayo wrote: command.CommandText = "INSERT into LOCATIONSCAN ((Scan[i].SSID),(Scan[i].MAC), (Scan[i].RSSi)) VALUES (@SSID, @MAC, @RSSi)";
That doesn't look like a valid SQL query. What are the column names in your LOCATIONSCAN table?
I would expect to see something more like:
INSERT into LOCATIONSCAN (SSID, MAC, RSSi) VALUES (@SSID, @MAC, @RSSi)
INSERT (Transact-SQL)[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
thanks for the correction, i will try INSERT (Transact-SQL)
|
|
|
|
|
using UnityEngine;
using System.Collections;
namespace InaneGames {
public class HangMan : MonoBehaviour
{
public char str;
public GUISkin guiskin;
public enum State
{
IDLE,
NEXT_WORD
};
public static bool check;
public static bool FW=true;
public bool rc;
private State m_state;
public float nextWordTime = 1;
private float m_nextWordTime;
public TextAsset[] fileTexts;
public int scoreBonusPerLetter = 15;
public int scorePunishPerWrongLetter = 20;
public char mysteryLetter = '!';
private bool resetLivesOnCorrectWord = true;
public int lives;
public int maxQuestions = 8;
public string freeLetters = " ";
public AudioClip onCorrectAC;
public AudioClip onIncorrectAC;
public AudioClip onRightWordAC;
public AudioClip onLoseAC;
private string[] m_words;
private bool[] m_gotLetter;
private string m_currentWord;
private int m_wordIndex=0;
private string m_word = "";
private int m_lives;
private int m_score = 0;
public int highScore;
private HangManGUI m_hangManGUI;
public bool chooseRandomCategory = true;
public void OnGUI () {
GUI.skin = guiskin;
GUI.Label ( new Rect (0, 0, 300, 40), " High Scores:" + highScore);
}
public void Awake()
{
highScore = PlayerPrefs.GetInt ("High Score", 0);
m_lives = lives;
int r = Misc.getIntValue("CATEGORY_INDEX");
if(chooseRandomCategory)
{
r = Random.Range(0,fileTexts.Length-1);
}
TextAsset ta = fileTexts[r];
string str = ta.text.ToUpper();
m_words = str.Split('\n');
m_words = randomizeArray(m_words);
m_hangManGUI = gameObject.GetComponent<HangManGUI>();
setNextWord();
if(m_hangManGUI)
{
m_hangManGUI.init( ta.name, m_word,m_lives);
}
}
public bool checkIfWordContainsLetter(string str)
{
rc = false;
for(int i=0; i<m_currentWord.Length; i++)
{
string tmp = m_currentWord[i].ToString();
if(tmp.Equals(str))
{
m_gotLetter[i]=true;
rc=true;
}
}
return rc;
}
public void fillWord()
{
m_word = "";
for(int i=0; i<m_currentWord.Length; i++)
{
if(m_gotLetter[i])
{
m_word += m_currentWord[i];
}else{
m_word += mysteryLetter.ToString();
}
}
}
void Update()
{
if(m_score > highScore){
highScore = m_score;
PlayerPrefs.SetInt("High Score", highScore);
PlayerPrefs.Save();
}
if(m_state == State.NEXT_WORD)
{
handleNextWord();
}
}
void handleNextWord()
{
m_nextWordTime-=Time.deltaTime;
if(m_nextWordTime<0)
{
m_state = State.IDLE;
setNextWord();
if(resetLivesOnCorrectWord)
{
m_lives = lives;
}
m_hangManGUI.setLives(m_lives);
}
}
void onCorrectLetter()
{
fillWord ();
m_hangManGUI.setWord( m_word );
if(m_word.Equals(m_currentWord))
{
if(audio)
{
audio.PlayOneShot(onRightWordAC);
}
m_score += m_currentWord.Length * scoreBonusPerLetter;
m_hangManGUI.setScore (m_score);
m_nextWordTime = nextWordTime;
m_state = State.NEXT_WORD;
}else{
if(audio)
{
audio.PlayOneShot(onCorrectAC);
}
}
}
void onIncorretLetter()
{
m_lives--;
m_hangManGUI.setLives ( m_lives );
m_score -= scorePunishPerWrongLetter;
m_hangManGUI.setScore(m_score);
if (m_lives > 0) {
if (audio) {
audio.PlayOneShot (onIncorrectAC);
}
} else {
if (audio) {
audio.PlayOneShot (onLoseAC);
}
m_hangManGUI.setGameOver (false);
}
}
public void selectLetter(string str)
{
if(checkIfWordContainsLetter(str))
{
onCorrectLetter();
}else{
onIncorretLetter();
}
}
void setNextWord()
{
if(m_wordIndex+1 <= m_words.Length)
{
m_currentWord = m_words[m_wordIndex++];
m_word = "";
m_gotLetter = new bool[m_currentWord.Length];
for(int i=0; i<m_currentWord.Length; i++)
{
m_gotLetter[i]=false;
if(isFreeLetter(m_currentWord[i]))
{
m_word += m_currentWord[i].ToString();
m_gotLetter[i]=true;
}else{
m_word += mysteryLetter.ToString();
}
}
m_hangManGUI.clearButtons();
m_hangManGUI.setWord(m_word);
}else{
m_hangManGUI.setGameOver(true);
}
}
public bool isFreeLetter(char str)
{
rc = false;
for (int i=0; i<freeLetters.Length; i++) {
if (str == freeLetters [i]) {
rc = true;
}
}
return rc;
}
public bool wholeword(){
rc = true;
for (int j=0; j<freeLetters.Length; j++) {
if (str == freeLetters[j]){
rc=true;
}}
return rc;}
string[] randomizeArray(string[] arr)
{
for (int i = arr.Length - 1; i > 0; i--)
{
int r = Random.Range(0,i);
var tmp = arr[i];
arr[i] = arr[r];
arr[r] = tmp;
}
return arr;
}
}
}
|
|
|
|
|
Member 11448796 wrote: but i am facing different errors when i call it in update.. Sorry, but you need to provide both context and detail; we cannot guess what errors you receive.
|
|
|
|
|
how can i show a pop up of high scores for few seconds when high scores are achieved in c#
|
|
|
|
|
Something along the lines of
if (score > oldHighScore)
popupScore.Show(); As you have given no indication of what platform this is about as much help as we can offer. The techniques are different in ASP.NET and WPF, for instance.
|
|
|
|
|
Hi Codeproject users,
How add i category tabel to product frm combo box?
Thanks
|
|
|
|
|
It's impossible to answer your question without you supplying some context as to what you're trying to do.
Add a "category label"? To what? What kind of app are we talking about? Windows Forms? WPF? ASP.NET? MVC? What is this "product" you're talking about? I'm assuming you have a database behind this? How were the tables setup? ...? ...?
The quality of the answer you get is directly determined by the quality of the question you ask.
|
|
|
|
|
thank you.
i have visual studio 2010 with C# and relation.
(table)Client textbox:
ClientID ----->(relation table Order)ClientID
Name
Address
Housenumber
Zipcode
Phonenumber
Date
(table)Order datagridview:
OrderID
ClientID
Item
Qlt
Price
TotalePrice
Identity add -1 -2 -3 -4 -5 i want without "-" how dow i that?
thanks
|
|
|
|
|
Exact same problem. You're just assuming we can all just read your mind and see your screen.
Have a nice life.
|
|
|
|
|
|
With the complete lack of information you provided, nobody.
|
|
|
|
|
|
Hey, the quality of the question you ask directly dictates the quality of the answer you get.
If you ask an incomprehensible question, don't expect any answers.
|
|
|
|
|
|
And? You STILL don't know how to ask a question. That one doesn't provide anywhere near enough detail.
I have no idea what you're talking about when you said "identity without a hyphen".
|
|
|
|
|
hello everyone,
i made an application in c#, when i supposed to run the application it shows the following error,
Unhandled exception has occured in your applicaion.if you click continue the applicaton will ignore this error and attempt to continue.if you click quit the application will close immediately
Access to the path 'c:\tmp is denied.
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.UnauthorizedAccessException: Access to the path 'c:\tmp' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at WaterMarking.ImageDoc.ImageDoc_Load(Object sender, EventArgs e) in C:\Users\Acer\Desktop\placement\projects\project3\WaterMarking\WaterMarking\ImageDoc.cs:line 936
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5485 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
WaterMarking
Assembly Version: 2.3.0.37769
Win32 Version: 2.3.0.37769
CodeBase: file:///C:/Users/Acer/Desktop/placement/projects/project3/WaterMarking/WaterMarking/bin/Debug/WaterMarking.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5483 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5485 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5483 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
DockingToolbar
Assembly Version: 1.0.1904.31915
Win32 Version: 1.0.1904.31915
CodeBase: file:///C:/Users/Acer/Desktop/placement/projects/project3/WaterMarking/WaterMarking/bin/Debug/DockingToolbar.DLL
----------------------------------------
WeifenLuo.WinFormsUI
Assembly Version: 1.2.1.0
Win32 Version: 1.2.1.0
CodeBase: file:///C:/Users/Acer/Desktop/placement/projects/project3/WaterMarking/WaterMarking/bin/Debug/WeifenLuo.WinFormsUI.DLL
----------------------------------------
ImageLib.Math
Assembly Version: 1.0.2893.5011
Win32 Version: 1.0.2893.5011
CodeBase: file:///C:/Users/Acer/Desktop/placement/projects/project3/WaterMarking/WaterMarking/bin/Debug/ImageLib.Math.DLL
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5483 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5485 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
ImageLib.Imaging
Assembly Version: 2.3.0.5413
Win32 Version: 2.3.0.5413
CodeBase: file:///C:/Users/Acer/Desktop/placement/projects/project3/WaterMarking/WaterMarking/bin/Debug/ImageLib.Imaging.DLL
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (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 computer
rather than be handled by this dialog box.
Please tell me what to do???

|
|
|
|
|
Look at the stack trace. It's telling you that the code blew up in your WaterMarking.ImageDoc.ImageDoc_Load method. You're doing something with a path, "C:\tmp", that isn't allowed by the user running the code.
|
|
|
|
|
To add to what Dave says, you should use Path.GetTempPath[^] to get the location of the temporary folder: "C:\tmp" would fail miserably on my pc, where the temp folder is on the "D:" drive!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Besides the above you might want to learn about logging libraries and how to catch exceptions and log them.
|
|
|
|
|
I need to ALTER merge sort algorithm to get length of an array and enter strings then sort them alphabetically ... Im stuck on the sort...my code atm.... The code doesnt sort as I know that it isnt comparing the strings it works in the original form with numbers already hard coded as in ALL the things i have seen and i understand the int sorting but as i said earlier i want it to accept inputted strings and compare them alphabetically and am finding no guidance on how this is to be achieved apart from the compareTo method...so when this runs i get the strings inputed on the txtoutput UNSorted but cant seem to alter the mergeSort to sort the entered strings alphabetically
private void btnExecute_Click(object sender, EventArgs e)
{
int length = Int32.Parse(Microsoft.VisualBasic.Interaction.InputBox("Enter a Number for how many Names to Sort :"));
string[] nameArray = new string[length];
foreach (string n in nameArray)
{
string name = Microsoft.VisualBasic.Interaction.InputBox("Enter " + length + " Names to add to Array:");
length = length - 1;
txtOutput.Text += name + "\r\n";
}
txtOutput.Text += nameArray.Length + "Names Added to List Unsorted ";
txtOutput.Text += "Sorted List : " + "\r\n";
mergeSort(nameArray, 0, nameArray.Length - 1);
foreach (string i in nameArray)
{
txtOutput.Text += i +"\t";
}
public void mergeSort(string[] nameArray, int lower, int upper)
{
int middle;
if (upper == lower)
return;
else
{
middle = (lower + upper) / 2;
mergeSort(nameArray, lower, middle);
mergeSort(nameArray, middle + 1, upper);
Merge(nameArray, lower, middle + 1, upper);
}
}
public void Merge(string[] nameArray, int lower, int middle, int upper)
{
string[] temp = new string[nameArray.Length];
int lowEnd = middle - 1;
int low = lower;
int n = upper - lower + 1;
while ((lower <= lowEnd) && (middle <= upper))
{
if ((nameArray[lower]).CompareTo(nameArray[middle])<= 0)
{
temp[low] = nameArray[lower];
low++;
lower++;
}
else
{
temp[low] = nameArray[middle];
low++;
middle++;
}
}
while (lower <= lowEnd)
{
temp[low] = nameArray[lower];
low++;
lower++;
}
while (middle <= upper)
{
temp[low] = nameArray[middle];
low++;
middle++;
}
for (int i = 0; i < n; i++)
{
nameArray[upper] = temp[upper];
upper--;
}
}
modified 12-Feb-15 6:50am.
|
|
|
|
|
int length = Int32.Parse(Microsoft.VisualBasic.Interaction.InputBox("Enter a Number for how many Names to Sort :"));
string[] nameArray = new string[length];
foreach (string n in nameArray)
{
You cannot use foreach at this point, since your array does not contain any strings. And even if it did, you never add them to the array. You should use the number as a loop counter and enter a string at each offset. Although you could probably improve this by using a collection class rather than an array.
|
|
|
|
|
Why? Sorting is already implemented in several places (for example in List<T> and Array, both are unstable introsorts)
|
|
|
|
|
The first thing you're going to have to do is actually split the strings out that you received in the InputBox. There's a massive hint there that you have to use string.Split to split the input[^] and return an array of characters.
|
|
|
|
|