 |
|

|
how to get all the tables from a particular database in c# codes???
|
|
|
|
|

|
Try:
SELECT column_name, data_type, is_nullable, character_maximum_length FROM information_schema.COLUMNS WHERE table_name='myTable'
Or
select column_name from information_schema.columns where table_name = 'Test'
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|

|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;
namespace tictoegame
{
public class gamestart
{
int functionalcount, computernumber,usernumber;
char[] box = new char[9];
static int j=6;
public gamestart()
{
for(int k=0;k<9;k++)
{
box[k] = ' ';
}
functionalcount = 0;
Random rd = new Random();
while(true)
{
computernumber = rd.Next(0, 8);
if (box[computernumber]!='x'&& box[computernumber]!='X'&&box[computernumber]!='o'&& box[computernumber]!='O')
{
insertvalue(computernumber,Program.computersymbol);
break;
}
}
functionalcount++;
userturn();
}
public void position()
{
int i=1;
Console.CursorLeft=i;
Console.CursorTop=j;
j++;
}
public void userturn()
{
if (functionalcount != 9)
{
bool flag1 = checkwin(Program.usersymbol);
if (flag1)
{
position();
Console.WriteLine("you won");
Thread.Sleep(3000);
Environment.Exit(0);
}
else
{
while (true)
{
position();
Console.WriteLine("enter the number for symbol");
usernumber = Convert.ToInt32(Console.ReadLine());
if (box[usernumber] != 'x' || box[usernumber] != 'X' && box[usernumber] != 'o' || box[usernumber] != 'O')
{
insertvalue(usernumber, Program.usersymbol);
functionalcount++;
break;
}
}
computerturn();
}
}
}
public void computerturn()
{
int count=0,i;
if (functionalcount == 2)
{
Random rd = new Random();
while (true)
{
computernumber = rd.Next(0, 8);
if((box[computernumber] != 'x' || box[computernumber] != 'X') && (box[computernumber] != 'o' || box[computernumber] != 'O'))
{
insertvalue(computernumber,Program.computersymbol);
functionalcount++;
break;
}
}
userturn();
}
if(functionalcount==4||functionalcount==6)
{
bool flag=checkthirdposition(Program.computersymbol,ref count);
bool flag1 = checkwin(Program.computersymbol);
if(flag1)
{
position();
Console.WriteLine("computer wins");
Thread.Sleep(3000);
Environment.Exit(0);
}
bool flag2=checkthirdposition(Program.usersymbol,ref count);
if(flag2)
{
box[count]=Program.computersymbol;
insertvalue(count,Program.computersymbol);
functionalcount++;
userturn();
}
else
{
Random rd = new Random();
while (true)
{
computernumber = rd.Next(0, 8);
if((box[computernumber] != 'x' || box[computernumber] != 'X' )&&( box[computernumber] != 'o' || box[computernumber] != 'O'))
{
insertvalue(computernumber,Program.computersymbol);
functionalcount++;
break;
}
}
userturn();
}
}
if(functionalcount==8)
{
int con;
for(i=0;i<9;i++)
{
if((box[i]!='x'||box[i]!='X')&&(box[i]!='o'||box[i]!='O'))
{
con=i;
box[con]=Program.computersymbol;
insertvalue(con,Program.computersymbol);
}
}
functionalcount++;
position();
Console.WriteLine("draw");
userturn();
}
}
public bool checkthirdposition(char ch, ref int x)
{
if (checkpos(1, 2, 0, ch) || checkpos(3, 6, 0, ch) || checkpos(4, 8, 0, ch))
{
if (ch == Program.computersymbol)
{
insertvalue(0, ch);
x = 0;
return true;
}
else
if(ch==Program.usersymbol)
{
x=0;
return true;
}
}
if (checkpos(0,2,1, ch) || checkpos(7,4,1,ch))
{
if (ch == Program.computersymbol)
{
insertvalue(1, ch);
x = 1;
return true;
}
else
if(ch==Program.usersymbol)
{
x = 1;
return true;
}
}
if(checkpos(0,1,2,ch) || checkpos(8,5,2,ch)||checkpos(6,4,2,ch))
{
if (ch == Program.computersymbol)
{
insertvalue(2, ch);
x = 2;
return true;
}
else
if(ch==Program.usersymbol)
{
x = 2;
return true;
}
}
if(checkpos(0,6,3,ch) || checkpos(5,4,3,ch))
{
if (ch == Program.computersymbol)
{
insertvalue(3, ch);
x = 3;
return true;
}
else
if(ch==Program.usersymbol)
{
x = 3;
return true;
}
}
if(checkpos(0,8,4,ch) || checkpos(2,6,4,ch)||checkpos(1,7,4,ch)||checkpos(3,5,4,ch))
{
if (ch == Program.computersymbol)
{
insertvalue(4, ch);
x = 4;
return true;
}
else
if(ch==Program.usersymbol)
{
x = 4;
return true;
}
}
if(checkpos(2,8,5,ch) || checkpos(3,4,5,ch))
{
if (ch == Program.computersymbol)
{
insertvalue(5, ch);
x = 5;
return true;
}
else
if(ch==Program.usersymbol)
{
x = 5;
return true;
}
}
if(checkpos(0,3,6,ch) || checkpos(2,4,6,ch)||checkpos(8,7,6,ch))
{
if (ch == Program.computersymbol)
{
insertvalue(6, ch);
x = 6;
return true;
}
else
if(ch==Program.usersymbol)
{
x = 6;
return true;
}
}
if(checkpos(1,4,7,ch) || checkpos(6,8,7,ch))
{
if (ch == Program.computersymbol)
{
insertvalue(7, ch);
x = 7;
return true;
}
else
if(ch==Program.usersymbol)
{
x = 7;
return true;
}
}
if(checkpos(2,5,8,ch) || checkpos(6,7,8,ch)||checkpos(0,4,8,ch))
{
if (ch == Program.computersymbol)
{
insertvalue(8, ch);
x = 8;
return true;
}
else
if(ch==Program.usersymbol)
{
x = 8;
return true;
}
}
return false;
}
public bool checkpos(int i, int j, int k, char ch1)
{
if ((box[i] == box[j] && box[i] == ch1) && (box[k] != 'x' || box[k] != 'X' || box[k] != 'o' || box[k] != 'O'))
{
return true;
}
else
{
return false;
}
}
public bool checkwin(char ch)
{
if((box[0] == box[1] && box[1]==box[2] && box[0]==ch)||(box[3]==box[4]&&box[4]==box[5]&&box[3]==ch)||(box[6]==box[7]&&box[7]==box[8]&&box[6]==ch)||((box[0]==box[3]&&box[3]==box[6]&&box[0]==ch)||
(box[1]==box[4]&&box[4]==box[7]&&box[1]==ch)||(box[2]==box[5]&&box[5]==box[8]&&box[2]==ch)||(box[0]==box[4]&&box[4]==box[8]&&box[0]==ch)||(box[6]==box[4]&&box[4]==box[2])&&box[6]==ch))
{
return true;
}
else
{
return false;
}
}
public void insertvalue(int x, char ch)
{
box[x] = ch;
switch (x)
{
case 0:
Console.SetCursorPosition(1, 0);
Console.Write(ch);
break;
case 1:
Console.SetCursorPosition(5, 0);
Console.Write(ch);
break;
case 2:
Console.SetCursorPosition(9, 0);
Console.Write(ch);
break;
case 3:
Console.SetCursorPosition(1,2);
Console.Write(ch);
break;
case 4:
Console.SetCursorPosition(5, 2);
Console.Write(ch);
break;
case 5:
Console.SetCursorPosition(9, 2);
Console.Write(ch);
break;
case 6:
Console.SetCursorPosition(1,4);
Console.Write(ch);
break;
case 7:
Console.SetCursorPosition(5, 4);
Console.Write(ch);
break;
case 8:
Console.SetCursorPosition(9,4);
Console.Write(ch);
break;
}
}
}
class Program
{
static public char usersymbol;
static public char computersymbol;
static void Main(string[] args)
{
Console.WriteLine(" to enter the symbol in any box number it from 1 to 9");
picksymbol();
Thread.Sleep(3000);
Console.Clear();
display();
resets();
gamestart gs = new gamestart();
Console.ReadLine();
}
public static void display()
{
Console.WriteLine(" " + " " +" "+ "|" + " " + " " +" "+ "|");
Console.WriteLine("_" + "_" + "_" + "|" + "_" + "_" + "_" + "|"+"_"+"_"+"_");
Console.WriteLine(" " + " " + " " + "|" + " " + " " + " " + "|");
Console.WriteLine("_" + "_" + "_" + "|" + "_" + "_" + "_" + "|" + "_" + "_" + "_");
Console.WriteLine(" " + " " + " " + "|" + " " + " " + " " + "|");
Console.WriteLine(" " + " " + " " + "|" + " " + " " + " " + "|");
}
public static void picksymbol()
{
while (true)
{
Console.WriteLine("enter the symbol-- either x or o");
usersymbol = Convert.ToChar(Console.ReadLine());
if (usersymbol == 'x' || usersymbol == 'X' || usersymbol == 'o' || usersymbol == 'O')
{
break;
}
}
if (usersymbol == 'x' || usersymbol == 'X')
{
Console.WriteLine(" you picked {0}", usersymbol);
computersymbol = 'o';
Console.WriteLine(" the computer symbol is {0}", computersymbol);
}
else
{
Console.WriteLine(" you picked {0}", usersymbol);
computersymbol = 'x';
Console.WriteLine(" the computer symbol is {0}", computersymbol);
}
}
static void resets()
{
int i,j;
for (i = 1, j = 0; j <= 4; i = i + 4)
{
Console.SetCursorPosition(i, j);
Console.Write(' ');
if (i == 9)
{
i = -3;
j = j + 2;
}
}
Console.WriteLine();
Console.WriteLine();
}
}
}
|
|
|
|

|
You haven't said what the problem really is, so how do you think we can help? You need to debug your application and try to narrow down what is happening yourself.
|
|
|
|
|

|
I was thinking about a software that can send messages without connecting any phone to your computer. You just have to register your number and than receiver's number and message will be send using your GSM services. If you know what i mean. It will use your phone's credit there is no role of phone physically. I am thinking about using c#. Help if someone can help me.
|
|
|
|

|
zain_zone wrote: Help if someone can help me. Help with what, exactly? All you have is a description of what the software should be able to do. No-one will write the software for you; if you want this idea to become reality, you'll have to start writing code. If you get stuck and have a specific question, we could help. "Help" means a pointer in the right direction, not "writing lots of code based on a vague idea". FWIW, I'd recommend researching whether what you want is technically possible.
I do not own a mobile phone, so these might be non-issues to you. Still, I'm wondering how this would work with a prepaid-phone. How will you perform a transaction without physical access to the phone?
Even without prepaid, let's assume a subscription. How would you know who my provider is, and how would you do a financial transaction on that? I bet it's not going to be easy, otherwise a lot of people would simply be stealing credits, wouldn't they?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|

|
I think you are right - at the very minimum you would need the IMEI number I assume. Sounds a bit "iffy" to me - would probably need to be discussed with the carrier companies before you could go ahead with it.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|

|
Hi
I need your help in,
I am working on a project, MYSQL and PHP based, with WAMP SERVER
I have a field storytext, (data collected in URDU) detail are:
<b>Field Type Collation Null Default
storytext text utf8_unicode_ci Yes NULL</b>
Retrieving URDU Data from MY SQL 5.5.8 running on wamp server with PHP is OK,
And the soft ware is only for Internal use not web base!
------------------------------------------------------------------------------------------
<b>HERE IS THE PROBLEM:</b>
One section of it is designed on Visual Studio.NET 2010 in which
I have a datagrid, on clicking any row I got the TEXT in details on text box,
which show <b>URDU TEXT</b>, from data base here is the problem with <b>TEXT BOX and DATAGRID.</b>
I got this..........
<b>DESP. ITEM
پروگرام رانا مب
شر ايٹ پرائم ٹائم ميں
گ٠تگو کرتے Û ÙˆØ¦Û’ وزير٠اعظم Ú©Û’
وکيل Ú†ÙˆÛ Ø¯Ø±ÙŠ اعتزاز Ø§ØØ³Ù†
کا Ú©Û Ù†Ø§ تھا Ú©Û ØµØ¯Ø± Ú©Û’ Ø¹Û Ø¯Û’
Ú©Ùˆ استشني ØØ§ØµÙ„ Û Û’
وزير٠اعظم Ø</b>
-------------------------------------------------------------------------------------------------------
I also use in visual studio
<b>cnString = "datasource=localhost;username=root;password=;database=spidernews;charset=utf8;"</b>
How can I solve this problem,
can you help me out !
<b>URDU NOT SHOWING, </b>
<pre lang="vb">Here is Whole CODE of Visual Studio, I am using:
------------------------------------------------------------------------------------------------------------------------</pre>
<pre lang="text">
Imports MySql.Data.MySqlClient
Public Class Form1
Dim conn As Common.DbConnection
Dim da As Common.DbDataAdapter
Dim ds As DataSet = New DataSet
Dim cnString As String
Dim sqlQRY As String
'Dim dt As DataTable
'Dim strBuilder As Char
'''' SCROLLONG TEXT START
Dim scrollingText As String = "Spider NEWS "
Dim txtStr(scrollingText.Length - 1) As String
Dim txtPos As Integer = -1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'strBuilder.ToString ("tblnews" & char(34))
cnString = "datasource=localhost;username=root;password=;database=spidernews;charset=utf8;"
sqlQRY = "SET NAMES UTF8; SET CHARACTER SET UTF8;Select slugid,slug,storytext,storyduration,segmentdescription,prioritydescription,mosstatus from tblnews"
'sqlQRY = "SET NAMES UTF8; SET CHARACTER SET latin1;Select slugid,slug,storytext,storyduration,segmentdescription,prioritydescription,mosstatus from tblnews"
conn = New MySqlConnection(cnString)
Try
conn.Open()
da = New MySqlDataAdapter(sqlQRY, conn)
Dim cb As MySqlCommandBuilder = New MySqlCommandBuilder(da)
da.Fill(ds, "tblnews")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "tblnews"
'''''
Catch ex As Common.DbException
MsgBox(ex.ToString)
Finally
conn.Close()
End Try
'''' SCROLLONG TEXT START
For idx As Integer = 0 To UBound(txtStr)
Dim workedString As String = ""
workedString = scrollingText.Substring(idx) & " " & scrollingText.Substring(0, idx)
txtStr(idx) = workedString
Next
Timer1.Interval = 5000
Timer1.Enabled = True
Timer1.Start()
'''' SCROLLONG TEXT END
Label2.Text = System.DateTime.Now
End Sub
Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
da.Update(ds, "" + TextBox1.Text + "")
MsgBox("Data sent", MsgBoxStyle.OkOnly, "Sucess")
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
Dim i, j As Integer
i = DataGridView1.CurrentRow.Index
RichTextBox1.Text = DataGridView1.Item(2, i).Value
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim i, j As Integer
i = DataGridView1.CurrentRow.Index
'''' SCROLLONG TEXT START
txtPos += 1
Dim timerStr As String
timerStr = txtStr(txtPos)
RichTextBox1.Text = DataGridView1.Item(2, i).Value
Label1.Text = timerStr
If txtPos = UBound(txtStr) Then txtPos = -1
'''' SCROLLONG TEXT START
End Sub
End Class
</pre>
|
|
|
|

|
This is not the correct forum for this question; try the VB.NET forum, and please fix the formatting of your message.
One of these days I'm going to think of a really clever signature.
|
|
|
|

|
I am working on setting up a C# 2010 application that will search directory file paths to see when there has been a files added
to the directory since the last time the directory was searched. I basically want to look for the following:
1. files that end with *.xls or *.xlsx.
2. I will look for files in the 'highest' level directory path and serach for new files that have been added since the last time the search was made.
Thus I am hoping you can tell me how to accomplish this goal and/or point me to referneces that will let me how to accomplish this goal.
|
|
|
|

|
rachel_m wrote: Thus I am hoping you can tell me how to accomplish this goal
..divide it into smaller pieces that can be conquered. Aint' that hard.
rachel_m wrote: that will search directory file paths to see when there has been a files added
to the directory since the last time the directory was searched.
I foresee a Sqlite-database (or similar) that holds all those names and the date/time they were encountered. Ideally, it'd also provide a hash-value of it's contents.
rachel_m wrote: I will look for files in the 'highest' level directory path and serach for new files that have been added since the last time the search was made.
Did you have a database-structure in mind for that?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|

|
Directory.GetFiles()[^] will help you find the list of names in the directory. From there you can check details such as date created etc.
One of these days I'm going to think of a really clever signature.
|
|
|
|

|
How do you tell when a new file has been added to a selected directory path?
|
|
|
|

|
rachel_m wrote: How do you tell when a new file has been added You can either keep a list of existing files and compare with that, or check the creation date to see whether it is newer than the last time you searched.
One of these days I'm going to think of a really clever signature.
|
|
|
|

|
Write a C# program to add the values of two integer variables, then
display the result with an appropriate message.
|
|
|
|

|
int a = 1;
int b = 2;
Console.Write("{0} + {1} might be equal to {2}", a, b, a + b);
I know homework is boring, but you won't learn much if I just give you the answer.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|

|
i know thank soooooo much.
|
|
|
|

|
becky suinner wrote: i know thank soooooo much.
You're cheating when you should be workin'. You'd better do your homework next time and learn the syntax of Console.WriteLine, because those kind of questions are often ignored here. There ain't no free lunches out there.
Google for 'MSDN Console WriteLine', and bookmark the thing called documentation; it might be your bread and butter one day.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|

|
i also need samples of winsforms or videos cos i tired deminoid.me dont think its functioning anymore.plssssssss
|
|
|
|

|
becky suinner wrote: i also need samples of winsforms or videos cos i tired deminoid.me dont think its functioning anymore.plssssssss
Drop the textspeak, and step into the land of adults
The documentation also contains video's[^], from the "How do I" department.
What is a deminoid[^]?
becky suinner wrote: plssssssss
If you want to be taken seriously, then don't repeat a character more than twice.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|

|
Start with these tutorials[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|

|
That is one of the most trivial applications you could write. The fact you could not manage it suggests that you need to buy this[^] book.
If we tell you how to solve your homework, it isn't helping you to learn how to code. If you want to do this professionally, you have to learn how to do this for yourself.
|
|
|
|

|
private void button4_Click(object sender, EventArgs e)
{
mycon.con.Close();
mycon.adp = new SqlDataAdapter("delete from Inquiry_management where Inquiry_ID='" +listBox1.SelectedIndex + "'", mycon.con);
mycon.adp.Fill(ds, "Inquiry_management");
mycon.con.Open();
mycon.con.Close();
listBox1.Update();
MessageBox.Show("Row Deleted");
}
|
|
|
|

|
There is no need to data Adapter , see this :
System.Data.SqlClient.SqlConnection sqlConnection1 =
new System.Data.SqlClient.SqlConnection("YOUR CONNECTION STRING ");
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
cmd.CommandType = System.Data.CommandType.Text;
cmd.CommandText = "delete from Inquiry_management where Inquiry_ID='" +listBox1.SelectedIndex + "'";
cmd.Connection = sqlConnection1;
sqlConnection1.Open();
cmd.ExecuteNonQuery();
sqlConnection1.Close();
|
|
|
|

|
it doesn't work because i am using the class method;
this is my class coding.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
///
/// Summary description for mycon
///
namespace WindowsFormsApplication1
{
class mycon
{
public static int x = 0;
public static SqlConnection con=new SqlConnection("Data Source=DRONAVAT-PC\\SQLEXPRESS;Initial Catalog=InventoryControl;Integrated Security=True");
public static SqlCommand cmd;
public static SqlDataReader dr;
public static SqlCommandBuilder cd;
public static SqlDataAdapter adp;
public static void enable()
{
}
public static void disable()
{
}
}
}
|
|
|
|

|
hi , i have a little problem here , i have a datagridview that has a plenty of rows and all of that rows are filling with persian words like ("مثلا یه چیزی") , when i'm trying to print this datagridview using printPreviewDialog + print document , it show me the words in wrong spelling . that mean if im seen this word ("محمد") in datagridview it'll print it like this one ("دمحم").
it print it inverse . i have used itextsharp and it also dosnt support persian language .
so any idea ?
|
|
|
|

|
mohammadkaab wrote: it print it inverse
Inverse? You mean from right to left? Most of us can't read Arabic, might be handy to have an English example.
Could you try the setting the RightToLeft[^] property and see if it helps?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|

|
It is printing in reverse the OP's example, "Muhammed" is doing the equivalent of:
"mhmd" is displaying as "dmhd"
I've left the vowels out in the above, as these are written as diacritic marks over/under the main characters for [short] vowels and are customarily left out for most texts. The irony is, I can't speak any other European languages except some schoolboy French and German. Oh and some words in Norwegian, Danish and Dutch are the same as the dialect of English that I speak.
|
|
|
|

|
Keith Barrow wrote: "mhmd" is displaying as "dmhd"
..and where did that extra 'd' come from? Too busy making a point to be correct, are we?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|

|
Have you set the RightToLeft property to true? IIRC you will get exactly the problems you describe (the letters being displayed in the reverse order) if you don't. If you can, set the property in the designer, not code.
I'm not sure about the print dialog, the RTL support in winforms is pretty poor.
|
|
|
|

|
couple hours ago , i had download the Spire.DataExport components , it work fine ,but i have a littile problem init , when i want to show my datatable Rows in Pdf it Show It Like this ???? like qustion mark , why ?
the language im using is persian and it's very close to Arabic language , the words is sth like this ("محمد کعب") and it show it like this ("???? ???").
even i have set the property of encoding to UTF8 but nothing happend , just gave me a strange words like this (Ù…ØÙ…).
|
|
|
|

|
You might be having a problem with two different encoding standards. Windows uses a standard for Arabic called Windows-1256. Farsi might be in the same standard. When it is displayed as UTF8 it displays as you describe, with accented characters. You'll need to either encode as UTF8 from Windows 1256 or just set the encoding to windows 1256.
You can see what I mean a bit better here http://forums.digitalpoint.com/showthread.php?t=537748[^]
|
|
|
|

|
I try to find a solution from many places, but not yet solved...and hence I have a
different issue for update dbf file [free table -vfp] from C# OleDbDataAdapter.
string MyConStr = "Provider=VFPOLEDB.1; Data Source='C:\\Temp'; Persist Security Info=False";
VFPDAp = new OleDbDataAdapter();
VFPDAp.InsertCommand = new OleDbCommand();
VFPDAp.UpdateCommand = new OleDbCommand();
VFPDAp.InsertCommand.CommandText = "insert into my_table1 (my_time,reminder) values(?, ?, ?)";
VFPDAp.UpdateCommand.CommandText = "update my_table1 set my_time=?, reminder=? where sl_no=? ";
VFPDAp.InsertCommand.Connection = OleCon1;
VFPDAp.UpdateCommand.Connection = OleCon1;
OleDbParameter Par1 = new OleDbParameter("my_time", -1);
Par1.DbType = DbType.String;
Par1.SourceColumn = "my_time";
Par1.ParameterName = "my_time";
OleDbParameter Par2 = new OleDbParameter("reminder", -1);
Par2.DbType = DbType.String;
Par2.SourceColumn = "reminder"; Par2.ParameterName = "reminder";
OleDbParameter Par3 = new OleDbParameter("my_time", -1);
Par3.DbType = DbType.String;
Par3.SourceColumn = "my_time";
Par3.ParameterName = "my_time";
OleDbParameter Par4 = new OleDbParameter("reminder", -1);
Par4.DbType = DbType.String;
Par4.SourceColumn = "reminder";
Par4.ParameterName = "reminder";
VFPDAp.InsertCommand.Parameters.Add(Par1);
VFPDAp.InsertCommand.Parameters.Add(Par2);
VFPDAp.UpdateCommand.Parameters.Add(Par3);
VFPDAp.UpdateCommand.Parameters.Add(Par4);
OleCon1.ConnectionString = MyConStr;
OleCon1.Open();
VFPDAp.Update(VfpTbl); OleCon1.Close();
Thanks For The Helps
|
|
|
|

|
Your update-command has three question marks (parameters), yet you assign only two. s1_no isn't added, and will be required.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|

|
Thanks Eddy.
While posting time unchecked, but my original code is
VFPDAp.InsertCommand.CommandText = "insert into my_table1 (my_time,reminder) values(?, ?)";
VFPDAp.UpdateCommand.CommandText = "update my_table1 set my_time=?, reminder=? where reminder=? ";
But showing the same error, SQL: Column 'Q0P2' is not found
Thanks Again
|
|
|
|

|
Paramu1973 wrote: "update my_table1 set my_time=?, reminder=? where reminder=? ";
Same answer still; you have 3 question-marks in there. That means that a IDbCommand will expect three parameters. It will fail if you only supply 2. From the previous code, it looks as if the primary key is missing.
"Which" record would the statement update? You'll either have to remove the condition (in which case "ALL" records will be updated, which is prolly false) or supply the third parameter.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|

|
Hi Eddy,
Thanks.......you cleared my 1 1/2 days headache...
Thousands of thanks to you....
Really, I become very upset because of that crazy error...
Thanks Again
|
|
|
|

|
Glad I could help a bit
|
|
|
|

|
The other day I have asked a question about a program which sits in a place where images come and once its started, function is that it updates when a new image is added, I have found a relevant code for this but I would like to know that would this do the desired task which I require. Appreciate any assistance.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Foundation;
using System.IO;
using System.Data.SqlClient;
using System.Data;
using System.Threading;
using WindowsFormsApplication1;
namespace HotFolderLoader
{
class Program
{
//private BaseFuncs theBaseFuncs = new BaseFuncs();
static void Main(string[] args)
{
string tt = System.Environment.MachineName;
Foundation.BaseFuncs theFoundation = new BaseFuncs();
if (tt == "NEO") //devel
{
//Foundation.getConstr.initialize("Data Source=neo\\neosqlserver;Initial Catalog=nmcvisualdb;Persist Security Info=True;User ID=sa;Password=xxxxxx");
Foundation.getConstr.initialize("Data Source=xx.xxx.xxx.xxx\\bcwebsql;Initial Catalog=nmcvisualdb;Persist Security Info=True;User ID=sa;Password=mr2BCweb");
//Foundation.getConstr.initialize("Data Source=xxx.xx.xxx.xxx\\nmcsql;Initial Catalog=nmcvisualdb;Persist Security Info=True;User ID=sa;Password=xxxxx");
}
else
{
Foundation.getConstr.initialize("Data Source=xx.xxx.xxx.xxx\\bcwebsql;Initial Catalog=nmcvisualdb;Persist Security Info=True;User ID=sa;Password=xxxxx");
}
//CCaseObject gg = new CCaseObject("test1-lil");
int idx = 0;
while (true)
{
System.Console.WriteLine("Starting");
doWork();
idx++;
System.Console.WriteLine("parsing: " + idx.ToString());
Thread.Sleep(80 * 1000);
}
}
public static void doWork()
{
BaseFuncs theBaseFuncs = new Foundation.BaseFuncs();
//D:\Google Drev\CloudHotFolder
//E:\google-drive\Google Drive\CloudHotFolder
DirectoryInfo dirInfo = new DirectoryInfo(@"D:\Google Drev\CloudHotFolder");
//DirectoryInfo dirInfo = new DirectoryInfo(@"E:\google-drive\Google Drive\CloudHotFolder");
FileInfo[] files = dirInfo.GetFiles("*.jpg");
string caseno = "";
string imageType = "";
string previousCaseno = "";
int i = 0;
System.Console.WriteLine("files: " + files.Count().ToString());
while (i < files.Count())
{
FileInfo fileItem = files[i];
bool nameOK = true;
bool isError = fileItem.Name.Contains("Error");
string[] fileData = fileItem.Name.Split('#');
if (fileData.Length < 2)
{
nameOK = false;
}
else
{
caseno = fileData[1];
imageType = fileData[2];
}
System.Console.WriteLine("parsing file: " + fileItem.FullName);
/*
* photo_org = 1,
floor_plan_org = 2,
Panorama_360 = 3,
photo_stage_2 = 4,
floor_plan_stage_2 = 5,
photo_thumbnail = 6,
Panorama_360_stage_2 = 7,
photo_final = 8,
floor_plan_final = 9,
Panorama_360_final = 10,
deleted = 11,
junk = 12,
visual_tour_org = 12,
visual_tour = 13
* */
string imgtypeid = "";
bool typeOK = true;
bool caseOK = true;
switch (imageType)
{
case "1":
case "4":
imgtypeid = "4"; //photo stage 2
break;
case "2":
case "5":
imgtypeid = "5"; //floor plan stage 2
break;
case "3":
case "7":
imgtypeid = "7";
break;
default:
typeOK = false;
break;
}
string sql = "select count(id) from cases where caseno ='" + caseno + "'";
string casecount = theBaseFuncs.doSQLScalar(sql);
if (casecount != "1")
{
caseOK = false;
}
if (typeOK && !isError && caseOK && nameOK)
{
try
{ //(expiryDate - DateTime.Now).Days < 30
if ((DateTime.Now - fileItem.LastAccessTime).Minutes > 1 && fileItem.Length > 10)
{
//check if filename exists
string checkSql = "select count (id) from images where case_id=" + theBaseFuncs.getCaseIDByCaseNo(caseno) + " and image_name='" + fileItem.Name + "'";
int count = Convert.ToInt16(theBaseFuncs.doSQLScalar(checkSql));
if (count > 0)
{
//delete image in db - and then normal upload new version
System.Console.Write("Deleting " + fileItem.Name + "in DB");
string delImages = "delete from images where case_id=" + theBaseFuncs.getCaseIDByCaseNo(caseno) + " and image_name='" + fileItem.Name + "'";
theBaseFuncs.doSQLnonQuery(delImages);
System.Console.Write("...Done");
}
int picID = theBaseFuncs.saveIMG2DB(fileItem, fileItem.Name, "image/jpeg", caseno, imgtypeid, 5, false);
SqlConnection connection = new SqlConnection("Data Source=xx.xxx.xxx.xxx\\bcwebsql;Initial Catalog=nmcvisualdb;Persist Security Info=True;User ID=sa;Password=xxxxx");
System.Drawing.Image img = System.Drawing.Image.FromFile(fileItem.FullName);
//System.Drawing.Image thumbImg = createHQThumb(fullImg, xparm);
string strSql = "UPDATE Images set Image_Data_Thumb=@imagedata ";
strSql += "where id=@picid";
SqlCommand updatecmd = new SqlCommand(strSql, connection);
updatecmd.CommandType = CommandType.Text;
SqlParameter pImg = new SqlParameter("@imagedata", SqlDbType.Image);
pImg.Value = BaseFuncs.imageToByteArray(BaseFuncs.createHQThumb(img, 600));
img.Dispose();
updatecmd.Parameters.Add(pImg);
SqlParameter pPicid = new SqlParameter("@picid", SqlDbType.Int);
pPicid.Value = picID;
updatecmd.Parameters.Add(pPicid);
connection.Open();
updatecmd.ExecuteNonQuery();
fileItem.Delete();
connection.Close();
//System.Console.WriteLine("counter: i=" + i.ToString() + " max=" + files.Count().ToString());
}
if (caseno != previousCaseno || i == files.Count() - 1) //do target check
{
if (i == files.Count())
{
System.Console.WriteLine("swapping caseno - lastfile in list!");
previousCaseno = caseno;
}
System.Console.Write("Making target check case: " + previousCaseno);
theBaseFuncs.logStatus(theBaseFuncs.getCaseIDByCaseNo(caseno), 3, 36, "Hotfolder target check");
if (theBaseFuncs.targetImgCheck(previousCaseno) == 1 && theBaseFuncs.targetPlanCheck(previousCaseno) == 1)
{
System.Console.Write("...target match");
Foundation.CCaseObject theCase = new Foundation.CCaseObject(previousCaseno);
theBaseFuncs.logStatus(theCase.CaseID, 3, 36, "Hotfolder target OK");
theCase.sendToNaming();
System.Console.Write("...case sent!!!!!!!!\n");
}
else
{
theBaseFuncs.logStatus(theBaseFuncs.getCaseIDByCaseNo(caseno), 3, 36, "Hotfolder target not OK");
System.Console.Write(".no match!\n");
}
}
previousCaseno = caseno;
}
catch (Exception ex)
{
string gg = ex.Message;
throw;
}
}
else
{
if (!isError)
{
fileItem.MoveTo(fileItem.FullName + ".type_error");
}
if (!caseOK)
{
fileItem.MoveTo(fileItem.FullName + ".caseno_error");
}
if (!nameOK)
{
fileItem.MoveTo(fileItem.FullName + ".navngivning_error");
}
}
i++;
}
}
}
}
modified 5-Oct-12 4:08am.
|
|
|
|

|
Firstly your code is not formatted so it is very difficult to read, please surround it with <pre> tags. Secondly, people here are unlikely to spend time analysing this code for you. Try it yourself to see whether it suits your needs and come back here when you have a more specific question.
One of these days I'm going to think of a really clever signature.
|
|
|
|

|
This is totally the wrong way to ask a question. See here[^].
First try yourself, if you get stuck or don't understand a specific part of it, come back here.
Nobody will do the work for you, but generally will point you in the right direction if they can.
|
|
|
|

|
my solution has two project. one is my actual project and another one is setup project. my actual project has one report folder where i store my all ssrs report.i have one folder in setup project called "SSRS_Repor". now i want that when i will do batch build then setup for my project regenerate and then i want to copy all files from report folder of my actual project to SSRS_Repor in my setup project. if i can do this kind of automation of copying files from one location to another folder of my setup project then i could be get rid of manual copying of rdls files. i hard this is possible by setup/deployment projects. i search google for this for details step-by-step instruction but got no good link. so please guide me how can i do it.
i post it to another forum too and some one told me below this
Open or create a setup/deployment project in Visual Studio 2005
Press F4 to display the Properties window
Click on the name of your setup/deployment project in the Solution Explorer
Click on the PostBuildEvent item in the Properties window to cause a button labeled "..." to appear
Click on the "..." button to display the Post-build Event Command Line dialog
Add a command line of your choice in the Post-build event command line text box
Build your project in Visual Studio and verify that the post-build event is executed after the main MSI build
so it is ok but what i need to write for copying files from one location to another location that is not clear to me. so now this is most important for me what to write for copying file during setup generation.
i got another clue like below one. script for setup Pre/Post Build Event but not aware properly. i got a sample like
copy /Y "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)lib\$(ProjectName).dll"
the above statement or line is not clear to me. what i need to write in my case? so need step-by-step guide.
tbhattacharjee
|
|
|
|

|
copy /Y "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)lib\$(ProjectName).dll"
This command copies a dll with the same name as the project, from the directory where it has been created to a directory called lib under the main solution directory. The /Y suppresses prompts to the user to confirm overwriting existing files. You can check the values of the macro parameters by editing the command and clicking on the Macros >> button.
One of these days I'm going to think of a really clever signature.
|
|
|
|

|
we know that a solution can have multiple project. so my solution has got two project like one is my main project and another is setup project.my main project has report folder and setup project has report folder too. now i want to write a script like as example copy /Y "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)lib\$(ProjectName).dll"
which will copy all rdlc files from report folder of my main project to report folder of setup project. can you please give me a right script which will copy all rdlc files from report folder of my main project to report folder of setup project.
so just click on this link http://i.stack.imgur.com/hEZBa.png and you see my project structure and also understand from where i want to copy all rdlc files. thanks
tbhattacharjee
|
|
|
|

|
As I said before, you can find the relevant directory paths from the macros in your project, so you just need something like :
copy /Y "$(ProjectDir)rdlcdir\*.rdlc" "$(SolutionDir)lib"
One of these days I'm going to think of a really clever signature.
|
|
|
|

|
Hello. I am confronting basic polymorphic issue in my small project. Classes Layer1 use classes from Layer2. Here is my design for Layer1
public class BaseLayer1
{
public virtual Function()
{}
}
public class ChildLayer1 : BaseLayer1
{
BaseLayer2 base2 = new BaseLayer2();
public override Function()
{
base2.Function(); }
}
Now overriden function in child class gets called here. But virtual function in base class from Layer2 is not getting called here (hence; in child classes of Layer2 as well) . Here is what I am trying
public class BaseLayer2
{
public virtual Function()
{}
}
public class Child1Layer2 : BaseLayer2 {
public override Function()
{}
}
public class Child2Layer2 : Child1Layer2 {
public override Function()
{}
}
What's wrong with my understanding with polymorphism in c# ? Thanks for any pointers.
This world is going to explode due to international politics, SOON.
|
|
|
|

|
When you everride a method, that gets called instead of the one in the base class, not as well as.
If you need the base class's method to be called as well, the inheriting class should call base.Function().
|
|
|
|
 |
|