Hi
Can you check the following code:
using System.Data.SqlClient;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;
SqlConnection conSql = new SqlConnection(ConnectionString);
ServerConnection con = new ServerConnection(conSql);
Server server = new Server(con);
DatabaseCollection dbCollection = server.Databases;
TableCollection tbls = dbCollection["YOURDBNAME"].Tables;
System.Collections.Specialized.StringCollection sCollection = tbls["YOURTABLENAME"].Script();
StringBuilder sb = new StringBuilder();
string[] tblscriptArray = new string[tbls["YOURTABLENAME"].Script().Count];
sCollection.CopyTo(tblscriptArray, 0);