Click here to Skip to main content
15,888,802 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am getting an error while creating table at run time in c# code,it says,
Format of the initialization string does not conform to specification starting at index 22.
Posted
Updated 16-Nov-11 22:15pm
v3

You can create DB script and execute using .NET code as below:

C#
Process scriptProc = new Process();
scriptProc.StartInfo.FileName = @"cscript"; 
scriptProc.StartInfo.Arguments ="//B //Nologo c:\scripts\test.vbs";
scriptProc.Start();
scriptProc.WaitForExit();
scriptProc.Close();
 
Share this answer
 
Comments
jawad khadri 17-Nov-11 0:25am    
can u please tell me a little bit clear.should we write the code in visual c# and when compiling it will auto generate is it?????
connect to mysql

Create your database
CREATE DATABASE IF NOT EXISTS databasename

now create ur table

CREATE TABLE IF NOT EXISTS `tblmasters` (
`uID` int(11) NOT NULL default '0',
`cData` varchar(75) NOT NULL default '',
`cDescription` varchar(250) NOT NULL default ' ',
`defaultV` varchar(5) NOT NULL default 'Y',
`cAbbrev` varchar(25) NOT NULL default '',
`cType` varchar(75) NOT NULL default '')
 
Share this answer
 
Comments
jawad khadri 17-Nov-11 0:26am    
can u please tell me a little bit clear.should we write the code in visual c# and when compiling it will auto generate is it?????
Menon Santosh 17-Nov-11 1:04am    
Yes U can write code in c#
jawad khadri 17-Nov-11 4:14am    
i am getting an error while creating table at run time in c# code,it says,
Format of the initialization string does not conform to specification starting at index 22.
It sounds to me like you have a malformed connection string. Check your connection string for the provider you are using http://www.connectionstrings.com/mysql
 
Share this answer
 
Comments
jawad khadri 17-Nov-11 5:50am    
thanks a lot it was indeed problem in my connection string

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900