16,020,669 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Visual Basic questions
View Javascript questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by NANDKUMAR GAIKWAD (Top 14 by date)
NANDKUMAR GAIKWAD
24-Jan-16 0:16am
View
try to get it with using of "switch case" it will definitely help you.
work hard you will get it.
or use following link
http://converter.telerik.com/
http://www.developerfusion.com/tools/convert/csharp-to-vb/
http://www.carlosag.net/tools/codetranslator/
inspect the link for every procedure you find the answer
NANDKUMAR GAIKWAD
22-Jan-16 3:51am
View
its all to you..sir ji
NANDKUMAR GAIKWAD
22-Jan-16 3:38am
View
total summary what i done over here
1) get schema of tally database
2) create table structure script as per your code
3) for that table structure i used your link of bulk copy and save database to sql server(here i at the same time of table creation and culk copy used).
thanx for your help it never possible that i could made it
NANDKUMAR GAIKWAD
21-Jan-16 23:31pm
View
thanx manas i'm trying on you answer
NANDKUMAR GAIKWAD
21-Jan-16 6:05am
View
i have a question manas it is possible that we can insert data into database without using insert statement
because right now i create database as per your answer but now i need to insert into database without insert statment
NANDKUMAR GAIKWAD
20-Jan-16 3:09am
View
i done it i'll send you what i done
NANDKUMAR GAIKWAD
20-Jan-16 3:00am
View
yes i debug and getting only output
"CREATE TABLE Table
)"
this is an outpu
can i send you full code with aspx
that you can debug you side
i cant find out exact problem
NANDKUMAR GAIKWAD
20-Jan-16 1:41am
View
i use your code as follow
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
//Label2.Text = "Table Name : " + Convert.ToString(ListBox1.SelectedItem.Text);
Label2.Text = "table name: " + Convert.ToString(DropDownList1.SelectedItem.Text);
//DataSet objds = fetchTallyTableContent(Convert.ToString(ListBox1.SelectedItem.Text));
DataSet objds = fetchTallyTableContent(Convert.ToString(DropDownList1.SelectedItem.Text));
GridView2.DataSource = objds;
GridView2.DataBind();
// Call the method
//DataTable yourDataTableObj = new DataTable();
//string sqlQuery = CreateTABLE(yourDataTableObj);
DataTable dt = new DataTable(Convert.ToString(DropDownList1.SelectedItem.Text));
string sqlQuery = CreateTABLE(dt);
textbox1.Text = sqlQuery;
}
public DataSet fetchTallyTableContent(string tblName)
{
//string query = "SELECT * FROM Techweb.TallyUser." + tblName + " " + tblName;
string query = "SELECT * FROM DatavisionITC.TallyUser." + tblName + " " + tblName;
string source = "PORT=9000;DRIVER=Tally ODBC Driver;SERVER={(local)}";
OdbcConnection con = new OdbcConnection(source);
OdbcCommand cmd = new OdbcCommand(query, con);
con.Open();
OdbcDataAdapter da = new OdbcDataAdapter(query, con);
DataSet ds = new DataSet();
da.Fill(ds);
con.Close();
return ds;
}
public static string CreateTABLE(DataTable table)
{
string sqlQuery;
sqlQuery = "CREATE TABLE " + table.TableName + "(";
for (int i = 0; i < table.Columns.Count; i++)
{
sqlQuery += "\n [" + table.Columns[i].ColumnName + "] ";
string columnType = table.Columns[i].DataType.ToString();
// You will get different data type in C#(you need to change it SQLServer):Boolean,Byte,Char,DateTime,Decimal,Double,Int16,Int32,Int64,SByte,Single, String,TimeSpan,UInt16,UInt32,UInt64
switch (columnType)
{
case "System.Int32":
sqlQuery += " int ";
break;
case "System.Int64":
sqlQuery += " bigint ";
break;
case "System.Int16":
sqlQuery += " tinyint ";
break;
case "System.Decimal":
sqlQuery += " decimal ";
break;
case "System.DateTime":
sqlQuery += " datetime ";
break;
case "System.String":
default:
sqlQuery += string.Format(" nvarchar({0}) ", table.Columns[i].MaxLength == -1 ? "max" : table.Columns[i].MaxLength.ToString());
break;
}
if (table.Columns[i].AutoIncrement)
sqlQuery += " IDENTITY(" + table.Columns[i].AutoIncrementSeed.ToString() + "," + table.Columns[i].AutoIncrementStep.ToString() + ") ";
if (!table.Columns[i].AllowDBNull)
sqlQuery += " NOT NULL ";
sqlQuery += ",";
}
return sqlQuery.Substring(0, sqlQuery.Length - 1) + "\n)";
}
}
i get table name but now problem is that output look like this
where i exactly mistaking i cant find out
"CREATE TABLE State
)"
this is an output
NANDKUMAR GAIKWAD
19-Jan-16 8:01am
View
yes i'm getting proper schema from i tried code..
but when i trying for single table or multiple table it not generate script
NANDKUMAR GAIKWAD
19-Jan-16 7:42am
View
there is no problem with binding i'm trying i get schema from my below code
string source = "PORT=9000;DRIVER=Tally ODBC Driver;SERVER={(local)}";
OdbcConnection con = new OdbcConnection(source);
con.Open();
DataTable dt = new DataTable();
string[] restrictions = new string[1];
dt = con.GetSchema("Tables");
Database db = new Database();
DropDownList1.DataSource = dt;
DropDownList1.DataTextField = "Table_Name";
DropDownList1.DataValueField = "Table_Name";
DropDownList1.DataBind();
i want how to generate table in sql server 2008 with this schema of table and there column name and there data type
but when i use your code i get that schema's datatable information
NANDKUMAR GAIKWAD
19-Jan-16 7:38am
View
Deleted
here i get an output of only
CREATE TABLE Tables(
[TABLE_CAT] nvarchar(max) ,
[TABLE_SCHEM] nvarchar(max) ,
[TABLE_NAME] nvarchar(max) ,
[TABLE_TYPE] nvarchar(max) ,
[REMARKS] nvarchar(max)
)
from your code
i'm also trying to get table name but i cant get..
can you help me
NANDKUMAR GAIKWAD
19-Jan-16 6:47am
View
thanx for suggestion.
and i'm new to here..but this is not excuse..
your answer is fabulous..
i send post my code and tell me what is wrong with that
NANDKUMAR GAIKWAD
19-Jan-16 6:44am
View
Deleted
thanx for suggestion.
NANDKUMAR GAIKWAD
19-Jan-16 6:43am
View
thanx but i'm new on code project i dont know where to comment and where to accept solution i'm trying my self...kindly adjust..thanx in advance
Show More